public void OnTriggerEnter(Collider other) { callAttack = FindObjectOfType <Boxer1Attacks>(); foundAttack = callAttack.attack; if (other.gameObject.tag == "Boxer1Left") { if (foundAttack == 1) { damage.jabHit(); } if (foundAttack == 3) { damage.hookHit(); } } else if (other.gameObject.tag == "Boxer1Right") { if (foundAttack == 2) { damage.crossHit(); } if (foundAttack == 4) { damage.uppercutHit(); } } }
// 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); } } }
public void OnTriggerEnter(Collider other) { callAttack = FindObjectOfType <Boxer1Attacks>(); foundAttack = callAttack.attack; if (other.gameObject.tag == "Boxer1Left") { if (foundAttack == 5) { damage.bodyJab(); } } else if (other.gameObject.tag == "Boxer1Right") { if (foundAttack == 6) { damage.bodyCross(); } } }