Exemplo n.º 1
0
        private IEnumerator IterateAllCommands_Coroutine(Action postExecutionAction)
        {
            HashSet <IUnit> unitsStillRunning = new HashSet <IUnit>(CommandsForUnit.Keys);

            while (unitsStillRunning.Count > 0)
            {
                foreach (var unit in unitsStillRunning.ToArray())
                {
                    var commands = CommandsForUnit[unit];

                    var currentCommand = commands.FirstOrDefault();

                    if (currentCommand == null || currentCommand.Status == CommandStatus.Failed)
                    {
                        CommandsForUnit.RemoveList(unit);
                        unitsStillRunning.Remove(unit);
                    }
                    else if (currentCommand.Status == CommandStatus.Succeeded)
                    {
                        commands.Remove(currentCommand);
                    }
                    else if (currentCommand.Status == CommandStatus.NotStarted)
                    {
                        currentCommand.StartExecution();
                    }
                }

                yield return(null);
            }

            postExecutionAction();
        }
 public void ClearForCiv(ICivilization civ)
 {
     PendingFreeBuildingsOfCiv.RemoveList(civ);
 }
Exemplo n.º 3
0
 private void OnCivilizationBeingDestroyed(ICivilization civ)
 {
     TechsResearchedByCiv.RemoveList(civ);
     ProgressByCivAndTech.Remove(civ);
 }