public bool ActionWithEnemies(string action, out bool exitAction) { exitAction = false; if (Int32.TryParse(action, out int result)) { if (result == enemies.Count()) { return(true); } else if (result == enemies.Count() + 1) { exitAction = true; return(true); } else if (result >= 0 && result < enemies.Count()) { if (FightEnemy(enemies[result])) { enemies.Remove(result); } } } return(false); }
private void OnDestroy() { collection.Remove(this); }