public void OnTriggerEnter(Collider other) { callAttack = FindObjectOfType <Boxer2Attacks>(); foundAttack = callAttack.attack; if (other.gameObject.tag == "Boxer2Left") { if (foundAttack == 1) { damage.jabHit(); } if (foundAttack == 3) { damage.hookHit(); } } else if (other.gameObject.tag == "Boxer2Right") { if (foundAttack == 2) { damage.crossHit(); } if (foundAttack == 4) { damage.uppercutHit(); } } }
// Update is called once per frame void Update() { stamina = FindObjectOfType <Boxer1Stamina> (); currentStamina = stamina.currentStamina; boxer1KnockedDown = FindObjectOfType <Boxer1Health> (); boxer1Down = boxer1KnockedDown.down; boxer2KnockedDown = FindObjectOfType <Boxer2Health> (); boxer2Down = boxer2KnockedDown.down; boxer2Attacks = FindObjectOfType <Boxer2Attacks> (); attackType = boxer2Attacks.attack; pointIncrease = FindObjectOfType <PointCounter> (); if (boxer1Down == false && boxer2Down == false && PauseMenu.gamePaused == false) { if (Input.GetButtonDown("Controller1LeftStick") && currentStamina >= 20f) { anim.SetBool("BackDodge", true); stamina.dodgeStamina(); if (attackType != 0) { pointIncrease.boxer1DefencePoints(); } } else { anim.SetBool("BackDodge", false); } if (Input.GetButtonDown("Controller1RightStick") && currentStamina >= 5f) { anim.SetBool("CentreBlock", true); stamina.blockStamina(); if (attackType != 0) { pointIncrease.boxer1DefencePoints(); } } else { anim.SetBool("CentreBlock", false); } } }
public void OnTriggerEnter(Collider other) { callAttack = FindObjectOfType <Boxer2Attacks>(); foundAttack = callAttack.attack; if (other.gameObject.tag == "Boxer2Left") { if (foundAttack == 5) { damage.bodyJab(); } } else if (other.gameObject.tag == "Boxer2Right") { if (foundAttack == 6) { damage.bodyCross(); } } }