protected override void _OnExecute(Game Game, Actor Actor, Double DeltaGameMinutes) { var Janitor = Actor as Janitor; Debug.Assert(Janitor != null); if (Game.GetTotalMinutes() > Janitor.GetLeavesAtMinute()) { Succeed(); } else { if (HasSubGoals() == false) { var CleaningTarget = Janitor.PeekCleaningTarget(); if (CleaningTarget != null) { var WalkToLocation = new TravelToLocation(); WalkToLocation.SetLocation(new Vector2(CleaningTarget.GetX() + CleaningTarget.GetWidth() / 2.0, CleaningTarget.GetY())); AppendSubGoal(WalkToLocation); var CleanDesk = new CleanDesk(); CleanDesk.SetCleaningTarget(CleaningTarget); AppendSubGoal(CleanDesk); } else { Succeed(); } } } }
protected override void _OnInitialize(Game Game, Actor Actor) { Debug.Assert(_Desk != null); var WalkToLocation = new TravelToLocation(); WalkToLocation.SetLocation(new Vector2(_Desk.GetX() + _Desk.GetWidth() / 2.0, _Desk.GetY())); AppendSubGoal(WalkToLocation); }
protected override void _OnExecute(Game Game, Actor Actor, Double DeltaGameMinutes) { var ITTech = Actor as ITTech; Debug.Assert(ITTech != null); if (Game.GetTotalMinutes() > ITTech.GetLeavesAtMinute()) { Succeed(); } else { if (HasSubGoals() == false) { var BrokenThing = Game.DequeueBrokenThing(); if (BrokenThing != null) { ITTech.SetRepairingTarget(BrokenThing); var FindPathToLocation = new TravelToLocation(); if (BrokenThing is Computer) { var Computer = (Computer)BrokenThing; FindPathToLocation.SetLocation(new Vector2(Computer.GetX() + Computer.GetWidth() / 2.0, Computer.GetY().GetFloored())); } else if (BrokenThing is Lamp) { var Lamp = (Lamp)BrokenThing; FindPathToLocation.SetLocation(new Vector2(Lamp.Left + Lamp.Width / 2.0, Lamp.Office.Floor)); } AppendSubGoal(FindPathToLocation); AppendSubGoal(new Repair()); AppendSubGoal(new GoToOwnDesk()); ITTech.SetAtDesk(false); } } } }
protected override void _OnInitialize(Game Game, Actor Actor) { Console.WriteLine("GoHome.Initialize"); var Person = Actor as Person; Debug.Assert(Person != null); Game.SpendMoney(Person.GetWage(), Person.GetMidLocation()); var WalkToLocation = new TravelToLocation(); if (Person.GetLivingSide() == LivingSide.Left) { WalkToLocation.SetLocation(new Vector2(Game.LeftBorder - 10.0, 0.0)); } else { WalkToLocation.SetLocation(new Vector2(Game.RightBorder + 10.0, 0.0)); } Person.SetAtDesk(false); AppendSubGoal(WalkToLocation); }