diff options
Diffstat (limited to 'ActiveRagdoll/Assets/TABG/Scripts/Data/StandingDataHandler.cs')
-rw-r--r-- | ActiveRagdoll/Assets/TABG/Scripts/Data/StandingDataHandler.cs | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Data/StandingDataHandler.cs b/ActiveRagdoll/Assets/TABG/Scripts/Data/StandingDataHandler.cs index 588f089..6a4aeb2 100644 --- a/ActiveRagdoll/Assets/TABG/Scripts/Data/StandingDataHandler.cs +++ b/ActiveRagdoll/Assets/TABG/Scripts/Data/StandingDataHandler.cs @@ -5,18 +5,64 @@ using UnityEngine; namespace Rigging.Data { - public class StandingDataHandler : MonoBehaviour + public class StandingDataHandler : RiggingDataBase { - // Start is called before the first frame update - void Start() + + public float sinceGrounded; // ÀëµØÊ±¼ä + + public float sinceLanded; + + public bool isGrounded; + + public float distanceToGround = 1f; + + private bool hasRecievedTouchedGround; + + private MovementDataHandler movementData; + + protected override void OnStart() + { + movementData = player.status.movementData; + } + + protected override void OnFixedUpdate() + { + sinceGrounded += Time.fixedDeltaTime; + sinceLanded += Time.fixedDeltaTime; + if ((double)sinceGrounded > 0.1) + { + isGrounded = false; + } + } + + protected override void OnLateUpdate() + { + hasRecievedTouchedGround = false; + } + + public void TouchGround(float distance, Vector3 normal) { - + //if (sinceGrounded > 0.5f && (bool)wobbleShake) + //{ + // wobbleShake.AddShake(-Vector3.up * 5f * Mathf.Pow(sinceGrounded, 1.5f), 0.8f); + //} + if (sinceGrounded > 0.5f) + { + Land(sinceGrounded); + } + sinceGrounded = 0f; + isGrounded = true; + if (distance > distanceToGround || !hasRecievedTouchedGround) + { + distanceToGround = distance; + } + hasRecievedTouchedGround = true; + //moveMentData.SetSlope(normal); } - // Update is called once per frame - void Update() + private void Land(float landForce) { - + sinceLanded = 0f; } } |