Example #1
0
    private void Start()
    {
        characterController = GetComponent <CharacterController>();
        anim = GetComponent <Animator>();
        //ikPersonagem = GetComponent<IKCharacter>();

        mainCamera = Camera.main;

        _characterState = _CharacterState.idle;
    }
Example #2
0
 void UpdateCharacterState()
 {
     //Pula
     if (jump)
     {
         _characterState = _CharacterState.jump;
     }
     //climb
     else if (jump && _characterState == _CharacterState.walking)
     {
         _characterState = _CharacterState.climb;
     }
     //Sobe
     else if ((jump && box != null) && characterController.isGrounded)
     {
         _characterState = _CharacterState.climb;
     }
     //Prepara para puxar
     else if (push && box != null)
     {
         _characterState = _CharacterState.push;
     }
     //Puxando
     else if ((push && moveInput != Vector3.zero) && box != null)
     {
         _characterState = _CharacterState.pushing;
     }
     //anda agachado
     else if (crouch && moveInput != Vector3.zero)
     {
         _characterState = _CharacterState.crouchWalking;
     }
     //agacha
     else if (crouch)
     {
         _characterState = _CharacterState.crouch;
     }
     //corre
     else if (run && moveInput != Vector3.zero)
     {
         _characterState = _CharacterState.running;
     }
     //anda
     else if (moveInput != Vector3.zero)
     {
         _characterState = _CharacterState.walking;
     }
     //parado
     else if (moveInput == Vector3.zero)
     {
         _characterState = _CharacterState.idle;
         anim.SetFloat("SpeedPercent", 0);
     }
 }