Beispiel #1
0
 private void Jumping()
 {
     if (rpgCharacterController.CanStartAction("Jump"))
     {
         if (GUI.Button(new Rect(25, 175, 100, 30), "Jump"))
         {
             rpgCharacterController.SetJumpInput(Vector3.up);
             rpgCharacterController.StartAction("Jump");
         }
     }
     if (rpgCharacterController.CanStartAction("DoubleJump"))
     {
         if (GUI.Button(new Rect(25, 175, 100, 30), "Jump Flip"))
         {
             rpgCharacterController.SetJumpInput(Vector3.up);
             rpgCharacterController.StartAction("DoubleJump");
         }
     }
 }
 void Update()
 {
     if (character != null)
     {
         RPGCharacterController controller = character.GetComponent <RPGCharacterController>();
         controller.SetJumpInput(Vector3.up);
         if (controller.CanStartAction("Jump"))
         {
             controller.StartAction("Jump");
         }
     }
 }
        public void Moving()
        {
            moveInput = new Vector3(inputMovement.x, inputMovement.y, 0f);
            rpgCharacterController.SetMoveInput(moveInput);

            // Set the input on the jump axis every frame.
            Vector3 jumpInput = isJumpHeld ? Vector3.up : Vector3.zero;

            rpgCharacterController.SetJumpInput(jumpInput);

            // If we pressed jump button this frame, jump.
            if (inputJump && rpgCharacterController.CanStartAction("Jump"))
            {
                rpgCharacterController.StartAction("Jump");
            }
            else if (inputJump && rpgCharacterController.CanStartAction("DoubleJump"))
            {
                rpgCharacterController.StartAction("DoubleJump");
            }
        }