add some extra assets FX and SFX
This commit is contained in:
@@ -40,6 +40,7 @@ public class artificialObjectGravity : MonoBehaviour
|
||||
public bool useCenterPointListForRigidbodies;
|
||||
public List<Transform> centerPointList = new List<Transform> ();
|
||||
|
||||
|
||||
RaycastHit hit;
|
||||
bool onGroundChecked;
|
||||
float groundAdherence = 10;
|
||||
@@ -48,7 +49,7 @@ public class artificialObjectGravity : MonoBehaviour
|
||||
bool objectActivated;
|
||||
float originalGravityForce;
|
||||
|
||||
Vector3 currentNormalDirection;
|
||||
Vector3 currentNormalDirection = Vector3.zero;
|
||||
|
||||
float minDistance;
|
||||
float currentDistance;
|
||||
@@ -350,6 +351,12 @@ public class artificialObjectGravity : MonoBehaviour
|
||||
public void setUseCenterPointListForRigidbodiesState (bool state, List<Transform> newCenterPointList)
|
||||
{
|
||||
useCenterPointListForRigidbodies = state;
|
||||
|
||||
centerPointList = newCenterPointList;
|
||||
}
|
||||
|
||||
public Vector3 getCurrentNormalDirection ()
|
||||
{
|
||||
return currentNormalDirection;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/artificialObjectGravity.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/gravityObjectManager.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -226,6 +226,8 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
public setGravity currentSetGravityManager;
|
||||
|
||||
bool currentSetGravityManagerAssigned;
|
||||
|
||||
bool surfaceFound;
|
||||
RaycastHit currentSurfaceFound;
|
||||
|
||||
@@ -252,6 +254,8 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
bool cameraShakeActive;
|
||||
|
||||
public bool showDebugPrint;
|
||||
|
||||
//Editor variables
|
||||
public bool showCircumnavigationhSettings;
|
||||
public bool showZeroGravitySettings;
|
||||
@@ -267,6 +271,9 @@ public class gravitySystem : gravityObjectManager
|
||||
Vector3 vector3Zero = Vector3.zero;
|
||||
Quaternion quaternionIdentity = Quaternion.identity;
|
||||
|
||||
float currentTime;
|
||||
|
||||
|
||||
void Awake ()
|
||||
{
|
||||
normalGravityMultiplier = playerControllerManager.getGravityMultiplier ();
|
||||
@@ -331,8 +338,30 @@ public class gravitySystem : gravityObjectManager
|
||||
}
|
||||
}
|
||||
|
||||
//void FixedUpdate ()
|
||||
void Update ()
|
||||
{
|
||||
currentTime = Time.fixedDeltaTime;
|
||||
|
||||
//rotate randomly the mesh of the player in the air, also make that mesh float while chooses a direction in the air
|
||||
if (turning) {
|
||||
if (randomRotationOnAirEnabled || powerActivated) {
|
||||
gravityCenter.transform.Rotate ((rotateAmount * currentTime) * turnDirection);
|
||||
}
|
||||
|
||||
if (weaponsManager.isCarryingWeaponInThirdPerson () || powers.isAimingPowerInThirdPerson ()) {
|
||||
turning = false;
|
||||
|
||||
checkRotateCharacter (vector3Zero);
|
||||
}
|
||||
}
|
||||
|
||||
if (hovering) {
|
||||
float posTargetY = Mathf.Sin (Time.time * hoverSpeed) * hoverAmount;
|
||||
mainRigidbody.position = Vector3.MoveTowards (mainRigidbody.position,
|
||||
mainRigidbody.position + posTargetY * playerTransform.up, currentTime * hoverSmooth);
|
||||
}
|
||||
|
||||
currentPosition = playerTransform.position;
|
||||
|
||||
checkGravityArrowState ();
|
||||
@@ -355,11 +384,11 @@ public class gravitySystem : gravityObjectManager
|
||||
surfaceAbove = true;
|
||||
} else {
|
||||
//if the ray doesn't found any surface, keep lifting the player until the timer reachs its target value
|
||||
timer -= Time.deltaTime;
|
||||
timer -= currentTime;
|
||||
|
||||
playerTransform.Translate ((Time.deltaTime * 4) * Vector3.up);
|
||||
playerTransform.Translate ((currentTime * 4) * Vector3.up);
|
||||
|
||||
playerCameraTransform.Translate ((Time.deltaTime * 4) * Vector3.up);
|
||||
playerCameraTransform.Translate ((currentTime * 4) * Vector3.up);
|
||||
}
|
||||
|
||||
//if the timer ends or a surface is found, stop the lifting and start rotate the player to float in the air
|
||||
@@ -418,7 +447,7 @@ public class gravitySystem : gravityObjectManager
|
||||
}
|
||||
|
||||
//make a lerp of the velocity applied to the player to move him smoothly
|
||||
mainRigidbody.linearVelocity = Vector3.Lerp (mainRigidbody.linearVelocity, newVelocity, Time.deltaTime * 2);
|
||||
mainRigidbody.linearVelocity = Vector3.Lerp (mainRigidbody.linearVelocity, newVelocity, currentTime * 2);
|
||||
|
||||
//set the direction of the ray that checks any surface
|
||||
rayPosition = pivotCameraTransform.position;
|
||||
@@ -522,14 +551,21 @@ public class gravitySystem : gravityObjectManager
|
||||
if (currentNormal != regularGravity) {
|
||||
searchingNewSurfaceBelow = true;
|
||||
searchingSurface = true;
|
||||
recalculatingSurface = false;
|
||||
|
||||
setRecalculatingSurfaceState (false);
|
||||
|
||||
circumnavigableSurfaceFound = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//walk in spheres and moving objects, recalculating his new normal and lerping the player to the new rotation
|
||||
if (!lifting && !searchingSurface && (circumnavigableSurfaceFound || playerIsChildOfParentActive) && recalculatingSurface && !rotating) {
|
||||
if (!lifting &&
|
||||
!searchingSurface &&
|
||||
(circumnavigableSurfaceFound || playerIsChildOfParentActive) &&
|
||||
recalculatingSurface &&
|
||||
!rotating) {
|
||||
|
||||
float rayDistance = 0.5f;
|
||||
|
||||
if (!onGround) {
|
||||
@@ -545,16 +581,23 @@ public class gravitySystem : gravityObjectManager
|
||||
surfaceFound = false;
|
||||
|
||||
//get the normal direction of the object below the player, to recalculate the rotation of the player
|
||||
if (Physics.Raycast (currentPosition + 0.1f * playerTransform.up, -playerTransform.up, out hit, rayDistance, layer)) {
|
||||
if (Physics.Raycast (playerTransform.position + 0.1f * playerTransform.up, -playerTransform.up, out hit, rayDistance, layer)) {
|
||||
currentSurfaceFound = hit;
|
||||
|
||||
surfaceFound = true;
|
||||
|
||||
currentCircumnagivateRotationSpeed = circumnavigateRotationSpeed;
|
||||
}
|
||||
//else {
|
||||
// print ("no surface found");
|
||||
|
||||
// Debug.DrawRay (playerTransform.position + 0.1f * playerTransform.up - playerTransform.up * rayDistance, playerTransform.up * 1000, Color.red, 3);
|
||||
//}
|
||||
|
||||
//Get the correct raycast orientation according to input, for example, it is no the same ray position and direction if the player is walking forward or backward on
|
||||
//first person or if he is aiming
|
||||
if (checkSurfaceBelowLedge || checkSurfaceInFront) {
|
||||
rayPosition = currentPosition + 0.1f * playerTransform.up;
|
||||
rayPosition = playerTransform.position + 0.1f * playerTransform.up;
|
||||
|
||||
if (playerControllerManager.isLookingInCameraDirection ()) {
|
||||
|
||||
@@ -670,27 +713,27 @@ public class gravitySystem : gravityObjectManager
|
||||
if ((!zeroGravityModeOn && !freeFloatingModeOn) || onGround) {
|
||||
if (useLerpRotation) {
|
||||
//recalculate the rotation of the player and the camera according to the normal of the surface under the player
|
||||
currentNormal = Vector3.Lerp (currentNormal, surfaceNormal, currentCircumnagivateRotationSpeed * Time.deltaTime);
|
||||
currentNormal = Vector3.Lerp (currentNormal, surfaceNormal, currentCircumnagivateRotationSpeed * currentTime);
|
||||
Vector3 myForward = Vector3.Cross (playerTransform.right, currentNormal);
|
||||
Quaternion dstRot = Quaternion.LookRotation (myForward, currentNormal);
|
||||
|
||||
playerTransform.rotation = Quaternion.Lerp (playerTransform.rotation, dstRot, currentCircumnagivateRotationSpeed * Time.deltaTime);
|
||||
playerTransform.rotation = Quaternion.Lerp (playerTransform.rotation, dstRot, currentCircumnagivateRotationSpeed * currentTime);
|
||||
|
||||
Vector3 myForwardCamera = Vector3.Cross (playerCameraTransform.right, currentNormal);
|
||||
Quaternion dstRotCamera = Quaternion.LookRotation (myForwardCamera, currentNormal);
|
||||
|
||||
playerCameraTransform.rotation = Quaternion.Lerp (playerCameraTransform.rotation, dstRotCamera, currentCircumnagivateRotationSpeed * Time.deltaTime);
|
||||
playerCameraTransform.rotation = Quaternion.Lerp (playerCameraTransform.rotation, dstRotCamera, currentCircumnagivateRotationSpeed * currentTime);
|
||||
} else {
|
||||
currentNormal = Vector3.Slerp (currentNormal, surfaceNormal, currentCircumnagivateRotationSpeed * Time.deltaTime);
|
||||
currentNormal = Vector3.Slerp (currentNormal, surfaceNormal, currentCircumnagivateRotationSpeed * currentTime);
|
||||
Vector3 myForward = Vector3.Cross (playerTransform.right, currentNormal);
|
||||
Quaternion dstRot = Quaternion.LookRotation (myForward, currentNormal);
|
||||
|
||||
playerTransform.rotation = Quaternion.Slerp (playerTransform.rotation, dstRot, currentCircumnagivateRotationSpeed * Time.deltaTime);
|
||||
playerTransform.rotation = Quaternion.Slerp (playerTransform.rotation, dstRot, currentCircumnagivateRotationSpeed * currentTime);
|
||||
|
||||
Vector3 myForwardCamera = Vector3.Cross (playerCameraTransform.right, currentNormal);
|
||||
Quaternion dstRotCamera = Quaternion.LookRotation (myForwardCamera, currentNormal);
|
||||
|
||||
playerCameraTransform.rotation = Quaternion.Slerp (playerCameraTransform.rotation, dstRotCamera, currentCircumnagivateRotationSpeed * Time.deltaTime);
|
||||
playerCameraTransform.rotation = Quaternion.Slerp (playerCameraTransform.rotation, dstRotCamera, currentCircumnagivateRotationSpeed * currentTime);
|
||||
}
|
||||
|
||||
updateCurrentRotatingNormal (currentNormal);
|
||||
@@ -709,7 +752,7 @@ public class gravitySystem : gravityObjectManager
|
||||
}
|
||||
|
||||
if (ignoreRecalculateSurface) {
|
||||
recalculatingSurface = false;
|
||||
setRecalculatingSurfaceState (false);
|
||||
|
||||
gravityPowerActive = false;
|
||||
}
|
||||
@@ -745,7 +788,7 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
//if the player can choosed a direction, lerp his velocity to zero
|
||||
if (choosingDirection) {
|
||||
mainRigidbody.linearVelocity = Vector3.Lerp (mainRigidbody.linearVelocity, vector3Zero, Time.deltaTime * 2);
|
||||
mainRigidbody.linearVelocity = Vector3.Lerp (mainRigidbody.linearVelocity, vector3Zero, currentTime * 2);
|
||||
}
|
||||
|
||||
if (rotating && !playerControllerManager.isPlayerRunning ()) {
|
||||
@@ -782,6 +825,18 @@ public class gravitySystem : gravityObjectManager
|
||||
previousSurfaceBelowPlayer = currentSurfaceBelowPlayer;
|
||||
|
||||
addParent (currentSurfaceBelowPlayer.gameObject);
|
||||
} else {
|
||||
if (!playerIsChildOfParentActive) {
|
||||
if (currentSetGravityManagerAssigned) {
|
||||
if (showDebugPrint) {
|
||||
print ("no parent found, refresing current surface below to check state");
|
||||
}
|
||||
|
||||
if (previousSurfaceBelowPlayer != null) {
|
||||
previousSurfaceBelowPlayer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (playerIsChildOfParentActive && !currentSurfaceBelowPlayer.IsChildOf (fatherDetected.transform)) {
|
||||
removeParent ();
|
||||
@@ -789,14 +844,14 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
//if the surface where the player lands can be circumnavigated or an moving/rotating object, then keep recalculating the player throught the normal surface
|
||||
if (circumnavigableSurfaceFound || playerIsChildOfParentActive) {
|
||||
recalculatingSurface = true;
|
||||
setRecalculatingSurfaceState (true);
|
||||
}
|
||||
//else disable this state
|
||||
else {
|
||||
recalculatingSurface = false;
|
||||
setRecalculatingSurfaceState (false);
|
||||
}
|
||||
} else {
|
||||
if (previousSurfaceBelowPlayer) {
|
||||
if (previousSurfaceBelowPlayer != null) {
|
||||
previousSurfaceBelowPlayer = null;
|
||||
}
|
||||
|
||||
@@ -911,27 +966,6 @@ public class gravitySystem : gravityObjectManager
|
||||
ignoreRecalculateSurface = state;
|
||||
}
|
||||
|
||||
//rotate randomly the mesh of the player in the air, also make that mesh float while chooses a direction in the air
|
||||
void FixedUpdate ()
|
||||
{
|
||||
if (turning) {
|
||||
if (randomRotationOnAirEnabled || powerActivated) {
|
||||
gravityCenter.transform.Rotate ((rotateAmount * Time.deltaTime) * turnDirection);
|
||||
}
|
||||
|
||||
if (weaponsManager.isCarryingWeaponInThirdPerson () || powers.isAimingPowerInThirdPerson ()) {
|
||||
turning = false;
|
||||
|
||||
checkRotateCharacter (vector3Zero);
|
||||
}
|
||||
}
|
||||
|
||||
if (hovering) {
|
||||
float posTargetY = Mathf.Sin (Time.time * hoverSpeed) * hoverAmount;
|
||||
mainRigidbody.position = Vector3.MoveTowards (mainRigidbody.position, mainRigidbody.position + posTargetY * playerTransform.up, Time.deltaTime * hoverSmooth);
|
||||
}
|
||||
}
|
||||
|
||||
void checkGravityArrowState ()
|
||||
{
|
||||
//the arrow in the back of the player looks to the direction of the real gravity
|
||||
@@ -986,12 +1020,12 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
//if the surface where the player lands can be circumnavigated or an moving/rotating object, then keep recalculating the player throught the normal surface
|
||||
if ((circumnavigableSurfaceFound || playerIsChildOfParentActive) && (gravityPowerActive || circumnavigateCurrentSurfaceActive || (zeroGravityModeOn && checkCircumnavigateSurfaceOnZeroGravity))) {
|
||||
recalculatingSurface = true;
|
||||
setRecalculatingSurfaceState (true);
|
||||
}
|
||||
|
||||
//else disable this state
|
||||
else {
|
||||
recalculatingSurface = false;
|
||||
setRecalculatingSurfaceState (false);
|
||||
}
|
||||
|
||||
//set the gravity force applied to the player to its regular state
|
||||
@@ -1052,9 +1086,9 @@ public class gravitySystem : gravityObjectManager
|
||||
playerCollider.isTrigger = true;
|
||||
|
||||
//get the last time that the player was in the air
|
||||
playerControllerManager.lastTimeFalling = Time.time;
|
||||
playerControllerManager.setLastTimeFalling ();
|
||||
|
||||
recalculatingSurface = false;
|
||||
setRecalculatingSurfaceState (false);
|
||||
|
||||
accelerating = false;
|
||||
|
||||
@@ -1159,7 +1193,7 @@ public class gravitySystem : gravityObjectManager
|
||||
playerCollider.isTrigger = false;
|
||||
|
||||
//get the last time that the player was in the air
|
||||
playerControllerManager.lastTimeFalling = Time.time;
|
||||
playerControllerManager.setLastTimeFalling ();
|
||||
|
||||
accelerating = false;
|
||||
|
||||
@@ -1185,7 +1219,7 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
lifting = false;
|
||||
|
||||
recalculatingSurface = false;
|
||||
setRecalculatingSurfaceState (false);
|
||||
|
||||
timer = 0.75f;
|
||||
|
||||
@@ -1221,7 +1255,7 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
gravityPowerActive = false;
|
||||
|
||||
currentSetGravityManager = null;
|
||||
setCurrentSetGravityManager (null);
|
||||
|
||||
searchNewSurfaceOnHighFallSpeedPaused = false;
|
||||
}
|
||||
@@ -1294,6 +1328,8 @@ public class gravitySystem : gravityObjectManager
|
||||
} else {
|
||||
playerIsChildOfParentActive = false;
|
||||
}
|
||||
|
||||
//print ("addParent " + playerIsChildOfParentActive);
|
||||
}
|
||||
|
||||
//remove the parent of the player, so he moves freely again
|
||||
@@ -1308,6 +1344,8 @@ public class gravitySystem : gravityObjectManager
|
||||
fatherDetected = null;
|
||||
|
||||
playerIsChildOfParentActive = false;
|
||||
|
||||
//print ("removeParent");
|
||||
}
|
||||
|
||||
public void setExternalGravityCenterAsParent ()
|
||||
@@ -1425,6 +1463,10 @@ public class gravitySystem : gravityObjectManager
|
||||
}
|
||||
|
||||
gravityPowerActive = true;
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("changeOnTrigger ");
|
||||
}
|
||||
}
|
||||
|
||||
//stop the gravity power when the player is going to drive a vehicle
|
||||
@@ -1434,7 +1476,8 @@ public class gravitySystem : gravityObjectManager
|
||||
gravityCenterCollider.enabled = false;
|
||||
|
||||
//get the last time that the player was in the air
|
||||
playerControllerManager.lastTimeFalling = Time.time;
|
||||
playerControllerManager.setLastTimeFalling ();
|
||||
|
||||
accelerating = false;
|
||||
|
||||
//set the force of the gravity in the player to its regular state
|
||||
@@ -1456,7 +1499,7 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
lifting = false;
|
||||
|
||||
recalculatingSurface = false;
|
||||
setRecalculatingSurfaceState (false);
|
||||
|
||||
timer = 0.75f;
|
||||
|
||||
@@ -1733,7 +1776,7 @@ public class gravitySystem : gravityObjectManager
|
||||
|
||||
updateCurrentRotatingNormal (currentNormal);
|
||||
|
||||
currentSetGravityManager = null;
|
||||
setCurrentSetGravityManager (null);
|
||||
}
|
||||
|
||||
public override Vector3 getCurrentNormal ()
|
||||
@@ -1860,6 +1903,8 @@ public class gravitySystem : gravityObjectManager
|
||||
public void setCurrentSetGravityManager (setGravity currentSetGravity)
|
||||
{
|
||||
currentSetGravityManager = currentSetGravity;
|
||||
|
||||
currentSetGravityManagerAssigned = currentSetGravityManager != null;
|
||||
}
|
||||
|
||||
public void setCurrentGravityCenterPoint (Transform newTransform)
|
||||
@@ -2497,7 +2542,16 @@ public class gravitySystem : gravityObjectManager
|
||||
}
|
||||
}
|
||||
|
||||
recalculatingSurface = false;
|
||||
setRecalculatingSurfaceState (false);
|
||||
}
|
||||
}
|
||||
|
||||
void setRecalculatingSurfaceState (bool state)
|
||||
{
|
||||
recalculatingSurface = state;
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("setRecalculatingSurfaceState " + state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/gravitySystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/objectToUseArtificialGravitySystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/parentAssignedSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -11,7 +11,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/setGravity.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/updateCharacterGravityTriggerSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -12,12 +12,9 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
public float gravityForce = 9.8f;
|
||||
|
||||
public bool searchNewSurfaceOnHighFallSpeed = true;
|
||||
public bool shakeCameraOnHighFallSpeed = true;
|
||||
public float minSpeedToShakeCamera = 10;
|
||||
|
||||
public bool checkSurfaceBelowOnRegularState;
|
||||
public float timeToSetNullParentOnAir = 0.5f;
|
||||
float lastTimeParentFound;
|
||||
|
||||
public bool changeDriverGravityWhenGetsOff = true;
|
||||
|
||||
@@ -53,6 +50,14 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
public bool adjustRotationToSurfaceFound;
|
||||
public Vector3 newGravityToStart;
|
||||
|
||||
[Space]
|
||||
[Header ("Shake Camera Settings")]
|
||||
[Space]
|
||||
|
||||
public bool shakeCameraOnHighFallSpeed = true;
|
||||
public float minSpeedToShakeCamera = 10;
|
||||
public bool cameraShakeCanBeUsed = true;
|
||||
|
||||
[Space]
|
||||
[Header ("Others Settings")]
|
||||
[Space]
|
||||
@@ -99,10 +104,12 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
public vehicleHUDManager HUDManager;
|
||||
public inputActionManager actionManager;
|
||||
|
||||
|
||||
Vector3 previousNormalDetected;
|
||||
|
||||
Transform vehicleCamera;
|
||||
|
||||
float lastTimeParentFound;
|
||||
|
||||
bool conservateSpeed;
|
||||
bool accelerating;
|
||||
@@ -156,6 +163,7 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
|
||||
float lastTimeRotateVehicleToRaycastDirection;
|
||||
|
||||
bool cameraShakeActive;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
@@ -272,7 +280,7 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
mainVehicleController.changeGravityControlUse (false);
|
||||
}
|
||||
|
||||
vehicleCameraManager.usingBoost (false, "StopShake", true, true);
|
||||
disableCameraShake ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,7 +290,7 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
//in case the vehicle reachs a certain velocity
|
||||
if (!OnGround && !powerActivated) {
|
||||
if (checkDownSpeedActive && shakeCameraOnHighFallSpeed && transform.InverseTransformDirection (mainRigidbody.linearVelocity).y < -minSpeedToShakeCamera) {
|
||||
vehicleCameraManager.usingBoost (true, "Regular Gravity Control", true, true);
|
||||
enableCameraShake ();
|
||||
}
|
||||
|
||||
if (searchNewSurfaceOnHighFallSpeed && transform.InverseTransformDirection (mainRigidbody.linearVelocity).y < -settings.velocityToSearch && !searchingNewSurfaceBelow && !powerActivated) {
|
||||
@@ -565,7 +573,7 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
if (OnGround) {
|
||||
if (!onGroundChecked) {
|
||||
|
||||
vehicleCameraManager.usingBoost (false, "stopShake", true, true);
|
||||
disableCameraShake ();
|
||||
|
||||
onGroundChecked = true;
|
||||
|
||||
@@ -716,7 +724,7 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
powerActivated = true;
|
||||
|
||||
//enable the gravity control in the vehicle controller
|
||||
vehicleCameraManager.usingBoost (true, "Regular Gravity Control", true, true);
|
||||
enableCameraShake ();
|
||||
|
||||
if (mainVehicleControllerLocated) {
|
||||
mainVehicleController.changeGravityControlUse (true);
|
||||
@@ -765,7 +773,7 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
}
|
||||
|
||||
//disable the gravity control in the vehicle controller
|
||||
vehicleCameraManager.usingBoost (false, "stopShake", true, true);
|
||||
disableCameraShake ();
|
||||
|
||||
if (mainVehicleControllerLocated) {
|
||||
mainVehicleController.changeGravityControlUse (false);
|
||||
@@ -843,7 +851,7 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
return;
|
||||
}
|
||||
|
||||
print ("ROTATE");
|
||||
//print ("ROTATE");
|
||||
|
||||
if (lastTimeRotateVehicleToRaycastDirection != 0) {
|
||||
if (Time.time < lastTimeRotateVehicleToRaycastDirection + 0.5f) {
|
||||
@@ -904,7 +912,7 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
mainVehicleController.changeGravityControlUse (false);
|
||||
}
|
||||
|
||||
vehicleCameraManager.usingBoost (false, "StopShake", true, true);
|
||||
disableCameraShake ();
|
||||
|
||||
if (rotateVehicleCoroutine != null) {
|
||||
StopCoroutine (rotateVehicleCoroutine);
|
||||
@@ -915,6 +923,35 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
}
|
||||
}
|
||||
|
||||
void accelerateCameraShake ()
|
||||
{
|
||||
if (cameraShakeCanBeUsed) {
|
||||
vehicleCameraManager.usingBoost (true, "Quick Gravity Control", true, true);
|
||||
|
||||
cameraShakeActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
void enableCameraShake ()
|
||||
{
|
||||
if (cameraShakeCanBeUsed) {
|
||||
vehicleCameraManager.usingBoost (true, "Regular Gravity Control", true, true);
|
||||
|
||||
cameraShakeActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
void disableCameraShake ()
|
||||
{
|
||||
if (cameraShakeCanBeUsed) {
|
||||
if (cameraShakeActive) {
|
||||
vehicleCameraManager.usingBoost (false, "StopShake", true, true);
|
||||
|
||||
cameraShakeActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void rotateVehicleToLandSurface (Vector3 hitNormal)
|
||||
{
|
||||
if (rotating && hitNormal == currentNormal) {
|
||||
@@ -1088,12 +1125,12 @@ public class vehicleGravityControl : gravityObjectManager
|
||||
if (increaseGravitySpeed) {
|
||||
accelerating = true;
|
||||
|
||||
vehicleCameraManager.usingBoost (true, "Quick Gravity Control", true, true);
|
||||
accelerateCameraShake ();
|
||||
} else {
|
||||
//stop to increase the velocity of the vehiclee in the air
|
||||
accelerating = false;
|
||||
|
||||
vehicleCameraManager.usingBoost (true, "Regular Gravity Control", true, true);
|
||||
enableCameraShake ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/vehicleGravityControl.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class zeroGravityRoomObjectChecker : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Setting")]
|
||||
[Space]
|
||||
|
||||
public bool checkGravityRoomStatesEnabled = true;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool objectInsideGravityRoom;
|
||||
|
||||
public zeroGravityRoomSystem currentZeroGravityRoom;
|
||||
|
||||
|
||||
public void setCurrentZeroGravityRoom (zeroGravityRoomSystem gravityRoom)
|
||||
{
|
||||
if (!checkGravityRoomStatesEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
currentZeroGravityRoom = gravityRoom;
|
||||
|
||||
objectInsideGravityRoom = currentZeroGravityRoom != null;
|
||||
}
|
||||
|
||||
public void checkAddObjectToCurrentRoom (GameObject newObject)
|
||||
{
|
||||
if (!checkGravityRoomStatesEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (objectInsideGravityRoom) {
|
||||
currentZeroGravityRoom.addObjectToRoom (newObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6132cafd0e9e24a4cbf356464627a57f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/zeroGravityRoomObjectChecker.cs
|
||||
uploadId: 889948
|
||||
@@ -366,7 +366,13 @@ public class zeroGravityRoomSystem : MonoBehaviour
|
||||
currentArtificialObjectGravity.setCurrentGravity (outsideGravityDirectionTransform.up);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zeroGravityRoomObjectChecker currentZeroGravityRoomObjectChecker = newObject.GetComponent<zeroGravityRoomObjectChecker> ();
|
||||
|
||||
if (currentZeroGravityRoomObjectChecker != null) {
|
||||
currentZeroGravityRoomObjectChecker.setCurrentZeroGravityRoom (null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +447,13 @@ public class zeroGravityRoomSystem : MonoBehaviour
|
||||
if (changeGravityForceForObjects && currentArtificialObjectGravity != null) {
|
||||
currentArtificialObjectGravity.setGravityForceValue (false, -newGravityForceForObjects);
|
||||
}
|
||||
}
|
||||
|
||||
zeroGravityRoomObjectChecker currentZeroGravityRoomObjectChecker = newObject.GetComponent<zeroGravityRoomObjectChecker> ();
|
||||
|
||||
if (currentZeroGravityRoomObjectChecker != null) {
|
||||
currentZeroGravityRoomObjectChecker.setCurrentZeroGravityRoom (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsPoint (Vector2 currentPosition)
|
||||
@@ -710,9 +722,14 @@ public class zeroGravityRoomSystem : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public bool isRoomHasZeroGravityActive ()
|
||||
{
|
||||
return roomHasZeroGravity;
|
||||
}
|
||||
|
||||
//EDITOR FUNCTIONS
|
||||
public void renameRoomPoints ()
|
||||
|
||||
//EDITOR FUNCTIONS
|
||||
public void renameRoomPoints ()
|
||||
{
|
||||
for (int i = 0; i < roomPointsList.Count; i++) {
|
||||
roomPointsList [i].name = (i + 1).ToString ();
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Gravity/zeroGravityRoomSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
Reference in New Issue
Block a user