Exemplo n.º 1
0
 private void MoveHero()
 {
     if (mJoystick.GetJoystickDirection() != Vector2.zero)
     {
         mHero.OnMove(mJoystick.GetJoystickDirection());
     }
     else
     {
         mHero.NoMove();
     }
 }
Exemplo n.º 2
0
        private void MovePlayer()
        {
            if (mPlayerAnimator != null)
            {
                Vector2 moveDirection = mJoystick.GetJoystickDirection();
                if (moveDirection != Vector2.zero)
                {
                    mPlayerAnimator.SetBool(mIsRunID, true);

                    Vector3 rotateVector = new Vector3(moveDirection.x, 0, moveDirection.y);
                    mPlayerAnimator.transform.rotation = Quaternion.LookRotation(rotateVector);
                    mPlayerRigidbody.AddForce(transform.forward * mSpeedForce);
                }
                else
                {
                    mPlayerAnimator.SetBool(mIsRunID, false);
                }
            }
        }