Example #1
0
        public override void OnUpdate(MainPlayerMovementFSM playerFSM)
        {
            if (Mathf.Abs(playerFSM.horizontalInput) == 0 && Mathf.Abs(playerFSM.verticalInput) == 0)
            {
                playerFSM.EnterState(playerFSM.idleState, true);
                return;
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                playerFSM.EnterState(playerFSM.jumpingState, true);
                return;
            }

            if (Input.GetKey(KeyCode.Mouse0))
            {
                playerFSM.EnterState(playerFSM.attackingReadyState, true);
                return;
            }

            if (Input.GetKeyDown(KeyCode.LeftShift) && playerFSM.IsMoving())
            {
                Debug.Log("Shift pressed!");
                playerFSM.EnterState(playerFSM.rollingState, true);
            }
        }
Example #2
0
 public override void OnUpdate(MainPlayerMovementFSM playerFSM)
 {
     if (!isJumping)
     {
         timerTime += Time.deltaTime;
     }
 }
Example #3
0
 public override void OnEnterState(MainPlayerMovementFSM playerFSM)
 {
     isJumping = false;
     timerTime = 0;
     //playerFSM.rigidbody.AddForce(Vector3.up * playerFSM.JumpingForce, ForceMode.Impulse);
     playerFSM.ApplyForce(Vector3.up * playerFSM.JumpingForce, ForceMode.Impulse);
     playerFSM.anim.SetTrigger("JumpingState");
 }
        public override void OnEnterState(MainPlayerMovementFSM playerFSM)
        {
            timerTime = 0;
            Vector3 direction = new Vector3(playerFSM.horizontalInput, 0f, playerFSM.verticalInput);

            //playerFSM.rigidbody.AddForce(direction.normalized * playerFSM.RollingForce, ForceMode.Impulse);
            playerFSM.ApplyForce(direction.normalized * playerFSM.RollingForce, ForceMode.Impulse);
            playerFSM.anim.SetTrigger("RollingState");
        }
Example #5
0
        public override void OnUpdate(MainPlayerMovementFSM playerFSM)
        {
            timerTime += Time.deltaTime;

            if (timerTime >= playerFSM.timeBeforeRollCompleted)
            {
                playerFSM.anim.SetTrigger("RollingEnds");
                playerFSM.EnterState(playerFSM.idleState, true);
            }
        }
Example #6
0
        public override void OnFixedUpdate(MainPlayerMovementFSM playerFSM)
        {
            if (playerFSM.AirControl)
            {
                playerFSM.MoveFixed();
            }

            if (timerTime >= timeBeforeJumpCheck)
            {
                isJumping = true;
            }

            if (isJumping)
            {
                Collider[] colliders = Physics.OverlapSphere(playerFSM.GroundCheckPoint.position, playerFSM.GroundCheckRadius, playerFSM.GroundMask);
                if (colliders.Length > 0)
                {
                    isJumping = false;
                    playerFSM.EnterState(playerFSM.idleState, true);
                }
            }
        }
Example #7
0
        public override void OnUpdate(MainPlayerMovementFSM playerFSM)
        {
            //playerFSM.Move();

            if (Mathf.Abs(playerFSM.horizontalInput) > 0 || Mathf.Abs(playerFSM.verticalInput) > 0)
            {
                playerFSM.EnterState(playerFSM.runningState, true);
                return;
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                playerFSM.EnterState(playerFSM.jumpingState, true);
                return;
            }

            if (Input.GetKey(KeyCode.Mouse0))
            {
                playerFSM.EnterState(playerFSM.attackingReadyState, true);
                return;
            }
        }
Example #8
0
 public override void OnEnterState(MainPlayerMovementFSM playerFSM)
 {
     playerFSM.anim.SetTrigger("RunningState");
 }
Example #9
0
 public override void OnEnterState(MainPlayerMovementFSM playerFSM)
 {
     timerTime = 0;
     playerFSM.anim.SetTrigger("RollingState");
 }
Example #10
0
 public override void OnFixedUpdate(MainPlayerMovementFSM playerFSM)
 {
     playerFSM.MoveFixed();
 }
Example #11
0
 public virtual void OnEnterState(MainPlayerMovementFSM playerFSM)
 {
 }
Example #12
0
 public virtual void OnCollisionExit(MainPlayerMovementFSM playerFSM, Collision collision)
 {
 }
Example #13
0
 public virtual void OnTriggerExit(MainPlayerMovementFSM playerFSM, Collider other)
 {
 }
Example #14
0
 public virtual void OnFixedUpdate(MainPlayerMovementFSM playerFSM)
 {
 }