コード例 #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();
        }
コード例 #2
0
 public void ClearForCiv(ICivilization civ)
 {
     PendingFreeBuildingsOfCiv.RemoveList(civ);
 }
コード例 #3
0
 private void OnCivilizationBeingDestroyed(ICivilization civ)
 {
     TechsResearchedByCiv.RemoveList(civ);
     ProgressByCivAndTech.Remove(civ);
 }