public void SelectInstruction(Instruction instruction) { this.Instruction = instruction; ActionLog.Add(new ActionLogEntry(-1, ActionType.InstructionStarted, DateTime.Now)); }
public async Task TickAsync(IGame game) { if (_ended) { return; } // if no factions are on the same map then pause operations var maps = Combatants.Keys.Select(c => c.Map.Id).Distinct(); if (maps.Count() == Combatants.Keys.Count()) { // no combatants are on the same map... skip return; } // any pending actions from not dead combatant? var entities = Combatants.Keys.Where(k => !Dead.Contains(k)).Select(o => o).ToList(); foreach (var entity in entities) { // player offline? if (entity.IsPlayer() && !game.Players.Contains((IPlayer)entity)) { // are there any players left? pause combat // i dont like making the specific decision about no offline combat here.. // needs configuration in future if (Combatants.Keys.Count(k => k.IsPlayer() && game.Players.Contains((IPlayer)k)) == 0) { return; } } var combatant = (ICombatant <GridTargetAction>)Combatants[entity]; if (combatant.CanAttack) { var nextAction = await combatant.GetNextActionAsync(this); if (nextAction == null) { continue; } if (nextAction.SourceEntity == null) { nextAction.SourceEntity = (GridEntity)entity; } if (nextAction.TargetEntities.Count == 0) { await nextAction.SetDefaultTargetAsync(this); } var executed = await nextAction.Execute(); if (executed) { LastAction = DateTime.Now; ActionLog.Add(nextAction); if (ActionExecuted != null) { await ActionExecuted.Invoke(this, nextAction); } } } } }
public void Activate() { IsShowing = false; ActionLog.Add(MockControllerAction.Activate); }
public void Close() { IsShowing = false; ActionLog.Add(MockControllerAction.Close); }
public void Show() { IsShowing = true; ActionLog.Add(MockControllerAction.Show); }