public override bool OnMesssage(Miner miner, Telegram telegram) { switch (telegram.messageType) { case MessageType.HiHoneyImHome: return(false); case MessageType.StewsReady: Printer.PrintMessageData("Message handled by " + miner.Id + " at time "); Printer.Print(miner.Id, "Okay Hun, ahm a comin'!"); miner.StateMachine.ChangeState(new EatStew()); return(true); default: return(false); } }
public override bool OnMesssage(Outlaw outlaw, Telegram telegram) { switch (telegram.messageType) { case MessageType.SheriffEncountered: Printer.Print(outlaw.Id, "Prepare to die instead, sheriff!"); Message.DispatchMessage(0, outlaw.Id, telegram.Sender, MessageType.Gunfight); return(true); case MessageType.Dead: outlaw.StateMachine.ChangeState(new DropDeadOutlaw()); return(true); case MessageType.Respawn: outlaw.StateMachine.ChangeState(new LurkInOutlawCamp()); return(true); } return(false); }
public override void Execute(MinersWife minersWife) { switch (rand.Next(3)) { case 0: Printer.Print(minersWife.Id, "Moppin' the floor"); break; case 1: Printer.Print(minersWife.Id, "Washin' the dishes"); break; case 2: Printer.Print(minersWife.Id, "Makin' the bed"); break; default: break; } }
public override bool OnMesssage(MinersWife minersWife, Telegram telegram) { switch (telegram.messageType) { case MessageType.HiHoneyImHome: // Ignored here; handled in WifesGlobalState below return(false); case MessageType.StewsReady: // Tell Miner that the stew is ready now by sending a message with no delay Printer.PrintMessageData("Message handled by " + minersWife.Id + " at time "); Printer.Print(minersWife.Id, "StewReady! Lets eat"); Message.DispatchMessage(0, minersWife.Id, minersWife.HusbandId, MessageType.StewsReady); minersWife.Cooking = false; minersWife.StateMachine.ChangeState(new DoHouseWork()); return(true); default: return(false); } }
public override bool OnMesssage(MinersWife minersWife, Telegram telegram) { switch (telegram.messageType) { case MessageType.HiHoneyImHome: Printer.PrintMessageData("Message handled by " + minersWife.Id + " at time "); Printer.Print(minersWife.Id, "Hi honey. Let me make you some of mah fine country stew"); minersWife.StateMachine.ChangeState(new CookStew()); return(true); case MessageType.StewsReady: return(false); case MessageType.SheriffEncountered: //Printer.PrintMessageData("Message handled by " + minersWife.Id + " at time "); Printer.Print(minersWife.Id, "Good day to you too, sir!"); return(true); default: return(false); } }
public override void Execute(Undertaker undertaker) { for (int i = 0; i < Agent.AgentsCount; ++i) { if (AgentManager.GetAgent(i).IsDead) { if (undertaker.CurrentPosition != AgentManager.GetAgent(i).CurrentPosition) { undertaker.StateMachine.ChangeState(new UndertakerTravelToTarget(AgentManager.GetAgent(i).CurrentPosition, new LookForDeadBodies())); return; } undertaker.CorpseID = i; } } Printer.Print(undertaker.Id, "Found the corpse of " + AgentManager.GetAgent(undertaker.CorpseID).GetType().Name + "."); if (undertaker.CorpseID >= 0) { undertaker.StateMachine.ChangeState(new UndertakerTravelToTarget(Location.cemetery, new DragOffTheBody())); } }
public override void Exit(Sheriff sheriff) { Printer.Print(sheriff.Id, "Leaving the Bank, time to celebrate!"); }
public override void Enter(Sheriff sheriff) { Printer.Print(sheriff.Id, "Arrived in bank."); }
public override void Enter(Outlaw outlaw) { Printer.Print(outlaw.Id, "Arrived in the cemetery!"); outlaw.BoredomCountdown = rand.Next(1, 10); }
public override void Enter(Outlaw outlaw) { Printer.Print(outlaw.Id, "Arrived in bank, Let's EARN some money!"); }
public override void Exit(Sheriff sheriff) { Printer.Print(sheriff.Id, "Leaving the saloon."); }
public override void Exit(Undertaker undertaker) { Printer.Print(undertaker.Id, "Leaving the office."); }
public override void Execute(Undertaker undertaker) { Printer.Print(undertaker.Id, "Hovering in the office."); }
public override void Enter(Undertaker undertaker) { path = pathFinder.FindPath(undertaker.CurrentPosition, targetPosition); Printer.Print(undertaker.Id, "Walkin' to " + LocationProperties.ToString(LocationProperties.GetLocation(targetPosition)) + "."); }
public override void Enter(Undertaker undertaker) { Printer.Print(undertaker.Id, "Arrived in the office!"); }
public override void Exit(Undertaker undertaker) { Printer.Print(undertaker.Id, "Leaving the cemetery"); }
public override void Enter(Undertaker undertaker) { Printer.Print(undertaker.Id, "Carrying the body to the tombs in the cemetery!"); }
public override void Enter(Sheriff sheriff) { Printer.Print(sheriff.Id, "Arrived in the saloon!"); }
public override void Execute(Sheriff sheriff) { Printer.Print(sheriff.Id, "All drinks on me today!"); sheriff.StateMachine.ChangeState(new SheriffTravelToTarget(sheriff.ChooseNextLocation(), new PatrolRandomLocation())); }
public override void Enter(Undertaker undertaker) { Printer.Print(undertaker.Id, "Arrived in " + LocationProperties.ToString(undertaker.Location) + "."); }
public override void Exit(MinersWife minersWife) { Printer.Print(minersWife.Id, "Puttin' the stew on the table"); }
public override void Enter(MinersWife minersWife) { Printer.Print(minersWife.Id, "Walkin' to the can. Need to powda mah pretty li'lle nose"); }
public override void Enter(MinersWife minersWife) { Printer.Print(minersWife.Id, "Time to do some more housework!"); }
public override void Exit(MinersWife minersWife) { Printer.Print(minersWife.Id, "Leavin' the Jon"); }
public override void Enter(Sheriff sheriff) { Printer.Print(sheriff.Id, "Goodbye, cruel world!"); sheriff.IsDead = true; }
public override void Exit(Outlaw outlaw) { Printer.Print(outlaw.Id, "Leaving the cemetery."); }
public override void Execute(MinersWife minersWife) { Printer.Print(minersWife.Id, "Ahhhhhh! Sweet relief!"); minersWife.StateMachine.RevertToPreviousState(); // this completes the state blip }
public override void Enter(Sheriff sheriff) { path = pathFinder.FindPath(sheriff.CurrentPosition, targetPosition); Printer.Print(sheriff.Id, "Walkin' to " + LocationProperties.ToString(LocationProperties.GetLocation(targetPosition)) + "."); }
public override void Execute(MinersWife minersWife) { Printer.Print(minersWife.Id, "Fussin' over food"); }
public override void Exit(Sheriff sheriff) { Printer.Print(sheriff.Id, "Leaving " + LocationProperties.ToString(sheriff.Location) + "."); }