public override void Die() { if (dead) { return; } this.health = 0; if (Network.peerType != NetworkPeerType.Server) { GameObject explinst = Instantiate(ExplosionGraphic, gameObject.transform.position, Quaternion.identity) as GameObject; explinst.transform.localScale *= ExplosionScale; AudioSource.PlayClipAtPoint(ExplosionSound, gameObject.transform.position); } if (!GlobalSettings.SinglePlayer) { MatchControl matchControl = GameObject.Find(GlobalSettings.MatchControlName).GetComponent <MatchControl>(); matchControl.ObjectDestroyed(this.gameObject); } ObjectSync objSync = this.GetComponent <ObjectSync>(); if (objSync != null && !GlobalSettings.SinglePlayer) { objSync.Dispose(); } dead = true; base.IsDead = true; Destroy(gameObject, 5); }
public virtual void Die() { if (this.IsDead) { return; } this.health = 0; this.shieldStrength = 0; ObjectSync objSync = this.GetComponent <ObjectSync>(); if (objSync != null && !GlobalSettings.SinglePlayer) { objSync.Dispose(); } this.IsDead = true; Destroy(gameObject); }