Esempio n. 1
0
        public void DoJump()
        {
            // Double jump?
            if (cState == CollisionState.AIR && jumpNum >= jumpMax)
            {
                return;
            }

            _jumpDirection = transform.up;

            // Wall jump?
            //if (cState == CollisionState.WALL)
            //{
            //    _jumpDir.Set(-_dir.x, _jumpDir.y);
            //    OnJumpWall.Raise(_void);
            //    Debug.LogWarning($"Wall Jump");
            //    Debug.LogWarning($"Jump Direction: {_jumpDir}");
            //}

            //ResetVelocity();
            //OnJump.Raise(_void);
            aState        = AirborneState.JUMP;
            _curVelocity += _jumpDirection * force;
            rb2D.velocity = _curVelocity;
            Debug.LogWarning($"Jump Force: {_curVelocity}");
            jumpNum++;
        }
Esempio n. 2
0
 public void OnJumpEndEvent()
 {
     if (cState == CollisionState.AIR)
     {
         aState = AirborneState.FREE;
     }
 }
Esempio n. 3
0
        private void DoFall()
        {
            if (aState != AirborneState.FALL)
            {
                aState = AirborneState.FALL;
                OnFall.Raise(_void);
            }

            _curVelocity += (Vector2)transform.up * (Physics2D.gravity.y * (fallMult - 1f) * Time.deltaTime);
            rb2D.velocity = _curVelocity;
        }
Esempio n. 4
0
 public void ResetJump()
 {
     jumpNum = 0;
     aState  = AirborneState.NONE;
 }