public Action <TimeSpan, IBasePlayer> GetTimedAction(BaseEnemy enemy, IBasePlayer player, BaseVerticalShooter.GameModel.IBaseMap gameMap) { var action = new Action <TimeSpan, IBasePlayer>((t, p) => { if (enemy.State == CharacterState.Alive) { if (accumulatedTime > Milestones.Last().End) { accumulatedTime = TimeSpan.FromSeconds(0); } var milestone = GetCurrentMilestone(); this.RoutineType = milestone.RoutineType; var milestoneExists = (milestone.Start != milestone.End); if (milestoneExists && milestone.RoutineType == RoutineType.Walk) { Walk(enemy, gameMap, t); } accumulatedTime = accumulatedTime.Add(t); enemy.CheckReload(); } }); return(action); }