public override void Execute(BaseGameEntity pEntity) { MinersWife wife = (MinersWife)pEntity; //1 in 10 chance of needing the bathroom (provided she is not already //in the bathroom) if ((Utils.RandFloat() < 0.1) && !wife.GetFSM().isInState(typeof(VisitBathroom))) { wife.GetFSM().ChangeState(new VisitBathroom()); } }
public override bool OnMessage(BaseGameEntity pEntity, Telegram pTelegram) { MinersWife wife = (MinersWife)pEntity; switch (pTelegram.Msg) { case (int)message_type.Msg_StewReady: { DebugMessages.Instance.WriteLine(String.Format("Message received by {0} at time {1}", MainSM.GetEntityName(pEntity.ID()), MessageDispatcher.Instance.GetRunningTime())); DebugMessages.Instance.WriteLine(String.Format("{0}: StewReady! Lets eat", MainSM.GetEntityName(pEntity.ID()))); //let hubby know the stew is ready MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY, wife.ID(), (int)EntityName.ent_Miner_Bob, (int)message_type.Msg_StewReady, (int)MessageDispatcher.NO_ADDITIONAL_INFO); wife.Cooking = false; wife.GetFSM().ChangeState(new DoHouseWork()); return(true); } }//end switch return(false); }
public override void Execute(BaseGameEntity pEntity) { MinersWife wife = (MinersWife)pEntity; DebugMessages.Instance.WriteLine(String.Format("{0}: Ahhhhhh! Sweet relief! ", MainSM.GetEntityName(pEntity.ID()))); wife.GetFSM().RevertToPreviousState(); }
private void Thread_ProgressChanged(object sender, ProgressChangedEventArgs e) { ArrayList arrReturnValue = DebugMessages.Instance.FlushMessages(); foreach (string strLine in arrReturnValue) { if (strLine.StartsWith(MainSM.GetEntityName((int)EntityName.ent_Miner_Bob))) { txtUpdates.SelectionColor = mColourBob; } else if (strLine.StartsWith(MainSM.GetEntityName((int)EntityName.ent_Elsa))) { txtUpdates.SelectionColor = mColourElsa; } else if (strLine.StartsWith(MainSM.GetEntityName((int)EntityName.ent_BarFly))) { txtUpdates.SelectionColor = mColourBarFly; } else { txtUpdates.SelectionColor = Color.Black; } txtUpdates.AppendText(strLine + Environment.NewLine); } if (e.ProgressPercentage == 100) { txtUpdates.SelectionColor = Color.Black; txtUpdates.AppendText(Environment.NewLine + "Demo Complete!" + Environment.NewLine); } else { lblLocationBob.Text = MainSM.GetLocation((int)Bob.Location); lblStatusBob.Text = Bob.GetFSM().CurrentState.GetType().Name.ToString(); lblLocationWife.Text = MainSM.GetLocation((int)Elsa.Location); lblStatusWife.Text = Elsa.GetFSM().CurrentState.GetType().Name.ToString(); lblLocationBarFly.Text = MainSM.GetLocation((int)Joe.Location); lblStatusBarFly.Text = Joe.GetFSM().CurrentState.GetType().Name.ToString(); } }
public override bool OnMessage(BaseGameEntity pEntity, Telegram pTelegram) { MinersWife wife = (MinersWife)pEntity; switch (pTelegram.Msg) { case (int)message_type.Msg_HiHoneyImHome: { double CurrentTime = MessageDispatcher.Instance.GetRunningTime(); DebugMessages.Instance.WriteLine(String.Format("Message handled by {0} at time: {1}", MainSM.GetEntityName(wife.ID()), CurrentTime)); DebugMessages.Instance.WriteLine(String.Format("{0}: Hi honey. Let me make you some of mah fine country stew", MainSM.GetEntityName(wife.ID()))); wife.GetFSM().ChangeState(new CookStew()); return(true); } } return(false); }