public void DestroyMinion() { if (_MinionCount > 0) { // Get the last minion in the pool GameObject minionObj = _POOL_Minions[_POOL_Minions.Count - 1]; Proj_ShieldMinion minion = minionObj.GetComponent <Proj_ShieldMinion>(); // Kill it minion.ForceDeath(); // Set new score _Owner._Player.SetScore(_MinionCount); } }
public override void OnDeath(Character instigator) { // Get last known alive position and store it base.OnDeath(instigator); // Destroy all minions in the character's shield Wep_Shield shield = _WeaponSpecial.GetComponent<Wep_Shield>(); foreach (var item in shield.GetMeatMinionPool()) { Proj_ShieldMinion minion = item.GetComponent<Proj_ShieldMinion>(); minion.ForceDeath(); } // Play OnDeath effect if (_EffectOnDeath != null) Instantiate(_EffectOnDeath, transform.position, Quaternion.identity); if (_Player.GetRespawnsLeft() > 0) { // Disable controller input _Active = false; // Deduct life from respawn cap _Player.DeductRespawn(); // Move character to its respawn point gameObject.transform.position = _RespawnPoint.position; // Start respawn timer _WaitingToRespawn = true; } // Player is out of lives and is eliminated from the match else { // Deduct life from respawn cap _Player.DeductRespawn(); // hide character & move out of playable space GetComponentInChildren<Renderer>().enabled = false; transform.position = new Vector3(1000, 0, 1000); // Show popup that a player has been eliminated MatchManager._pInstance.OnPlayerEliminated(_Player); // Find self in active pool foreach (var necromancer in PlayerManager._pInstance.GetActiveNecromancers()) { // Once we have found ourself in the pool if (necromancer == this) { // Move to inactive pool PlayerManager._pInstance.GetEliminatedNecromancers().Add(necromancer); PlayerManager._pInstance.GetActiveNecromancers().Remove(necromancer); break; } } // Set our match placement depending on how many other players are still alive in the game int playersRemaining = PlayerManager._pInstance.GetActiveNecromancers().Count; _Player.SetPlacement(playersRemaining + 1); // Disable controller input _Active = false; } // Instigator plays a taunt if (instigator.GetComponent<Char_Geomancer>().GetDialog() != null) instigator.GetComponent<Char_Geomancer>().GetDialog().PlayTaunt(); // Play death sound if (_CharacterDialog != null) _CharacterDialog.PlayOnDeath(); }