public override void ActivatePhase(RoboPhase previousPhase) { base.ActivatePhase(previousPhase); currentKillItWithFirePhase = KillItWithFireStep.MoveFromWall; }
public override void ActivatePhase(RoboPhase previousPhase) { isDriving = false; isTurning = false; }
public override void ActivatePhase(RoboPhase previousPhase) { Robot.BodyColor = System.Drawing.Color.Black; TurnHeadingToNearestWall(); }
public virtual void DeactivatePhase(RoboPhase nextPhase) { }
public virtual void ActivatePhase(RoboPhase previousPhase) { }
public override void ActivatePhase(RoboPhase previousPhase) { base.ActivatePhase(previousPhase); currentMeetAndGreetPhase = MeetAndGreetStep.MoveForward; Robot.SetTurnLeft(Robot.Heading % 90); }
public override void Run() { try { Console.WriteLine("START"); BodyColor = Color.Black; GunColor = Color.White; RadarColor = Color.White; CurrentPhase = RoboPhase.WallRush; RoboPhase changePhase = RoboPhase.UnknownPhase; IsAdjustGunForRobotTurn = true; while (true) { foreach (var enemies in KnownEnemies.Where(r => (Time - r.Value.Time) >= 30).ToArray()) { KnownEnemies.Remove(enemies.Key); } if (TargetEnemyName != null && !KnownEnemies.ContainsKey(TargetEnemyName)) { TargetEnemyName = null; } if (phases.ContainsKey(CurrentPhase)) { if (phases[CurrentPhase] is IAdvancedPhase) { IAdvancedPhase phase = (IAdvancedPhase)phases[CurrentPhase]; if (CurrentPhase != changePhase) { phase.ActivatePhase(changePhase); changePhase = CurrentPhase; Execute(); } phase.Tick(); if (CurrentPhase != changePhase) { Execute(); phase.DeactivatePhase(changePhase); } else { Execute(); } } else { changePhase = CurrentPhase; phases[CurrentPhase].Run(); Execute(); } } } } catch (Exception e) { exception = e; Console.WriteLine(e.GetType().Name); Console.WriteLine(e.Message ?? "Unkown"); throw e; } }