private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "PlayerProjectile") { GameObject go = collision.gameObject; OrcKingProjectile proj = go.AddComponent <OrcKingProjectile>(); proj.ChangeColour(myColour); } else if (collision.gameObject.tag == "OrcKingProjectile") { Destroy(collision.gameObject); } }
public void TakeDamage(float amount, GameObject projectile) { if (projectile.GetComponent <OrcKingProjectile>()) { OrcKingProjectile proj = projectile.GetComponent <OrcKingProjectile>(); if (proj.projectileColour == currentColours) { health -= amount; if (health <= 0) { //winning; } } } }