add some extra assets FX and SFX

This commit is contained in:
Robii Aragon
2026-03-29 23:03:14 -07:00
parent 6ef3eb1535
commit 24dc66a81e
10142 changed files with 2535978 additions and 36608 deletions

View File

@@ -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);
}
}