Пример #1
0
    // Update is called once per frame
    void Update()
    {
        stamina           = FindObjectOfType <Boxer2Stamina> ();
        currentStamina    = stamina.currentStamina;
        boxer1KnockedDown = FindObjectOfType <Boxer1Health> ();
        boxer1Down        = boxer1KnockedDown.down;
        boxer2KnockedDown = FindObjectOfType <Boxer2Health> ();
        boxer2Down        = boxer2KnockedDown.down;
        boxer1Attacks     = FindObjectOfType <Boxer1Attacks> ();
        attackType        = boxer1Attacks.attack;
        pointIncrease     = FindObjectOfType <PointCounter> ();

        if (boxer1Down == false && boxer2Down == false && PauseMenu.gamePaused == false)
        {
            if (Input.GetButtonDown("Controller2LeftStick") && currentStamina >= 20f)
            {
                anim.SetBool("BackDodge", true);
                stamina.dodgeStamina();
                if (attackType != 0)
                {
                    pointIncrease.boxer2DefencePoints();
                }
            }
            else
            {
                anim.SetBool("BackDodge", false);
            }

            if (Input.GetButtonDown("Controller2RightStick") && currentStamina >= 5f)
            {
                anim.SetBool("CentreBlock", true);
                stamina.blockStamina();
                if (attackType != 0)
                {
                    pointIncrease.boxer2DefencePoints();
                }
            }
            else
            {
                anim.SetBool("CentreBlock", false);
            }
        }
    }