public virtual IEnumerator DestroyThis()
{
// Call callback
if (this.Killed != null)
{
this.Killed();
}
TextMesh deathInt = this.objectManager.Map.enemyDeathInt.GetObjectFromPool<TextMesh>(this.objectManager.Map.enemyDeathInt.name, new Vector3(this.transform.position.x, 40, this.transform.position.z), Quaternion.Euler(new Vector3(90, 0, 0)));
deathInt.gameObject.name = this.objectManager.Map.enemyDeathInt.name;
if (this.onNode.enemie == this)
{
this.onNode.enemie = null;
}
this.objectManager.DeReference(this);
if (this.onNode == this.objectManager.WaveManager.destinationNode)
{
this.objectManager.gameState.PlayerHealth -= this.damageValue;
deathInt.text = "-" + this.damageValue;
}
else if (!this.objectManager.gameState.gameOver)
{
this.objectManager.gameState.playerMoney += this.moneyValue;
this.objectManager.gameState.score += this.moneyValue;
deathInt.text = "+" + this.moneyValue;
}
animator.SetTrigger("Dead");
yield return new WaitForSeconds(1.5f);
// remove debuffs
foreach (var debuff in debuffs)
{
debuff.EndEffect();
}
debuffs.Clear();
this.gameObject.ReturnToPool(this.gameObject.name);
}