void OnTurnBasedEntityRemoved(IGroup <PoolEntity> group, PoolEntity entity, int index, IComponent component) { // get previous node before removing node from list var currentTurnNode = pool.currentTurnNode.value; var prevNode = currentTurnNode.PreviousOrLast(); var removed = pool.turnOrder.value.Remove(entity); if (removed && currentTurnNode != null && currentTurnNode.Value == entity) { if (prevNode.List == null) { pool.RemoveCurrentTurnNode(); } else { pool.ReplaceCurrentTurnNode(prevNode); } } }