void OnTriggerEnter2D(Collider2D coll) { if (coll.tag == "Player" && this.tag != "PlayerProjectile") { Destroy(gameObject); PlayerHealth = FindObjectOfType <ApeHealth>(); PlayerHealth.AddDamage(damage); } }
void OnTriggerEnter2D(Collider2D coll) { if (coll.tag == "Player") { player = FindObjectOfType <ApeHealth>(); player.AddDamage(player.MaxHealth); } else if (coll.tag == "Enemy") { enemy = FindObjectOfType <EnemyHealth>(); enemy.addDamage(enemy.maxhealth); } }
void OnTriggerEnter2D(Collider2D coll) { if (coll.tag == "Enemy" && this.tag != "EnemyProjectile") { // Debug.Log(coll.tag); EnemyHealth enem = coll.gameObject.GetComponent <EnemyHealth>(); enem.addDamage(damage); } if (coll.tag == "Player" && this.tag != "PlayerProjectile") { ApeHealth ape = coll.gameObject.GetComponent <ApeHealth>(); ape.AddDamage(damage); } }
void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.layer == 8) { Debug.Log(dog.transform.localRotation.z); if (dog.transform.localRotation.z < 0) { dog.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0)); } else { dog.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0)); } } if (coll.tag == "Player") { ApeHealth ape = coll.gameObject.GetComponent <ApeHealth>(); ape.AddDamage(damage); } }