Пример #1
0
    void FightPlayer()
    {
        targetX = player.transform.position.x;

        if (reachedDest && attackCooldown <= 0)
        {
            Debug.Log("Attack");
            anim.SetTrigger("attack");
            mover.Attack();
            attackCooldown = 3;
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        horizontalAxis = Input.GetAxis("Horizontal");

        if (Input.GetButtonDown("Fire1"))
        {
            animHandler.Attack();
            playerMove.Attack();
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            playerMove.SetJump(true);
        }
        else
        {
            playerMove.SetJump(false);
        }

        playerMove.SetAxisValue(horizontalAxis);
        animHandler.SetAxisValue(horizontalAxis);
    }