private void Start() { cam = GetComponent <Camera>(); cam.orthographicSize = maxSize; hero = FindObjectOfType <HeroMovements>(); }
void OnTriggerEnter(Collider other) { if (HeroMovements.verifyIfAttack() && other.tag == "Enemy" && !invincible) { combatScript.removeEnemyLife(getDamage(), other.gameObject); PlayerCollisionScript.updateEnemyHP(other.gameObject, transform.position); invincible = true; Invoke("resetEnemyInvulnerability", 1); } }
void OnTriggerEnter(Collider other) { if (enemy.GetComponent <Animator>().GetBool("enemyAttack") && !enemy.GetComponent <Animator>().GetBool("enemyDied") && other.tag == "Hero" && !HeroMovements.verifyIfBlocking() && !invincible) { GameObject.Find("EventSystem").GetComponent <CombatScript>().removeHeroLife(1, enemy); invincible = true; Invoke("resetInvulnerability", 2); } if (other.tag == "Hero" && HeroMovements.verifyIfBlocking()) { heroAnimator.SetTrigger(Animator.StringToHash("Blocked")); } }