void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Enemy") || other.gameObject.CompareTag("EnemyProjectile")) { PhasedGameObject pso = other.GetComponent <PhasedGameObject>(); if ((pso.objectPhase & gm.CurrentPhase) == 0 && !shielded) { audioSourceDeath.Play(); gameObject.SetActive(false); gm.RespawnPlayer(gameObject, 1); } } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Projectile")) { PhasedGameObject pso = other.GetComponent <PhasedGameObject>(); if ((pso.objectPhase & objectPhase) == 0) { GameObject clone = Instantiate(deathParticle, transform.position, transform.rotation); Destroy(gameObject); Destroy(other.gameObject); gm.UpdateScore(scoreValue); audioSourceDeath.Play(); } } }