void onProjectileCollide(ProjectileDataLogic p) { if (p == null || p.sender == gameObject) { return; } int power = p.power; Destroy(p.gameObject); damage(p.power); }
void onTriggerProjectile(ProjectileDataLogic p) { if (p == null || this == null || p.sender == null || p.sender.GetComponent <PlayerShipControlerLogic>() == null) { return; } m_ship.life -= p.power; m_lifebar.show(m_ship.life, m_ship.maxLife); Destroy(p.gameObject); if (m_ship.life <= 0) { onKill(true); } else { SoundSystem.instance.play(m_damageClip, 0.15f); onDamage(); } }