예제 #1
0
    // Update is called once per frame
    void Update()
    {
        // ========================================= [Movement Control]

        moveDirection = (Input.GetAxis("Horizontal"));

        // Dash Control
        if (Input.GetButton("Dash"))
        {
            movementController.Dash();
        }

        // move the character
        movementController.Move(moveDirection);

        // Jump Control
        if (Input.GetButtonDown("Jump"))
        {
            movementController.Jump();
        }

        // ========================================= [Attack Control]

        if (Input.GetButtonDown("Attack"))
        {
            // determine the directional
            float hor  = Input.GetAxis("Horizontal");
            float vert = Input.GetAxis("Vertical");

            // determine what kind of att
            AttackController.AttackDirection dir;
            if (Mathf.Abs(hor) > Mathf.Abs(vert) && Mathf.Abs(hor) > minimumDirectionalInput)
            {
                dir = AttackController.AttackDirection.Side;
            }
            else if (Mathf.Abs(vert) > Mathf.Abs(hor) && Mathf.Abs(vert) > minimumDirectionalInput)
            {
                if (vert > 0)
                {
                    dir = AttackController.AttackDirection.Up;
                }
                else
                {
                    dir = AttackController.AttackDirection.Down;
                }
            }
            else
            {
                dir = AttackController.AttackDirection.Neutral;
            }

            attackController.StartAttack(dir, AttackController.AttackTrigger.Attack);
        }
    }
예제 #2
0
 public void StartAttack(int attackNumber = 0)                        //seta preparacoes para iniciar o ataque/dar dano (chamar pela animacao [comeco]) //(argumento int obrigatorio para ataques basicos)
 {
     attackController.StartAttack(gameObject.name, attackNumber - 1); //(argumento string opcional, para testes)
 }