Esempio n. 1
0
 private void HandleMelee()
 {
     if (AIState == AIStates.Melee)
     {
         if (currentAttackLoadTime <= 0)
         {
             character.Attack();
             currentTimeBetweenAttacks = timeBetweenAttacks;
             AIState        = AIStates.Wait;
             targetPosition = target.targetObject.transform.position;
             movementController.lastInputMove = (targetPosition - this.transform.position).normalized;
             SetToIdleAfter(attackLoadTime);
             character.immune = false;
         }
         else
         {
             currentAttackLoadTime -= Time.deltaTime;
         }
     }
 }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (controllable && Input != null)
        {
            inputMove.x = Input.GetAxis("MoveHorizontal");
            inputMove.y = Input.GetAxis("MoveVertical");
            inputAim.x  = Input.GetAxis("AimHorizontal");
            inputAim.y  = Input.GetAxis("AimVertical");

            movementController.MoveUpdate(inputMove, inputAim);

            if (Input.GetButtonDown("Attack"))
            {
                if (character != null)
                {
                    character.Attack();
                }
            }
            if (Input.GetButtonDown("Jump"))
            {
                if (movementController != null)
                {
                    movementController.Jump();
                }
            }
            if (Input.GetButtonDown("Shot"))
            {
                if (character != null)
                {
                    character.StartShoting();
                }
            }
            if (Input.GetButtonUp("Shot"))
            {
                if (character != null)
                {
                    character.StopShoting();
                }
            }
            if (Input.GetButtonDown("Defence"))
            {
                if (movementController != null)
                {
                    movementController.StartBlocking();
                }
            }
            if (Input.GetButtonUp("Defence"))
            {
                if (movementController != null)
                {
                    movementController.StopBlocking();
                }
            }
            if (Input.GetButtonDown("Dash"))
            {
                if (movementController != null)
                {
                    movementController.Dash();
                }
            }
        }
    }