public override void Execute(Wife wife)
        {
            switch (random.Next(0, 2))
            {
            case 0:
            {
                Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Moppin' the floor.");
                return;
            }

            case 1:
            {
                Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Washin' the dishes.");
                return;
            }

            case 2:
            {
                Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Makin' the bed.");
                return;
            }

            default:
                return;
            }
        }
예제 #2
0
        public void DispatchMessage(double delay, int sender, int reciever, msg_type msg, object ExtraInfo)
        {
            BaseEntity pSender   = EntityMgr.GetEntityFromID(sender);
            BaseEntity pReciever = EntityMgr.GetEntityFromID(reciever);

            if (pReciever == null)
            {
                Console.WriteLine("Warning! No Reciever with ID " + reciever + " is found!");
            }

            Telegram telegram = new Telegram(0, sender, reciever, msg, ExtraInfo);

            if (delay <= 0.0f)
            {
                Console.WriteLine("Instant telegram dispatched at time: " + string.Format(" {0:HH:mm:ss tt}", DateTime.Now) + " by " + EntityType.GetEntityName(pSender.ID)
                                  + " for " + EntityType.GetEntityName(pReciever.ID) + ". Message is: " + MsgType.GetMsgName(msg));
                Discharge(pReciever, telegram);
            }
            else
            {
                double currenttime = CrudeTimer.Instance.GetCurrentTime();
                telegram.DispatchTime = currenttime + delay;
                PriorityQ.Add(telegram);
                Console.WriteLine("Delayed telegram from " + EntityType.GetEntityName(pSender.ID) + " recorded at time " + string.Format(" {0:HH:mm:ss tt}", CrudeTimer.Instance.GetCurrentTime()) + " for " + EntityType.GetEntityName(pReciever.ID)
                                  + ". Message is: " + MsgType.GetMsgName(msg));
            }
        }
 public override void Enter(Miner miner)
 {
     if (miner.m_Location != Location.Bank)
     {
         Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Goin' to the bank. Yes siree.");
         miner.m_Location = Location.Bank;
     }
 }
 public override void Enter(Miner miner)
 {
     if (miner.m_Location != Location.Goldmine)
     {
         Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Walkin' to the gold mine.");
         miner.m_Location = Location.Goldmine;
     }
 }
 public override void Enter(Wife wife)
 {
     if (wife.m_pLocation != Locations.house)
     {
         Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Gonna do some cleanin'.");
         wife.m_pLocation = Locations.house;
     }
 }
 public override void Enter(Wife wife)
 {
     if (wife.m_pLocation != Locations.bathroom)
     {
         Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Walkin' to the can. Need to powda mah pretty li'l nose.");
         wife.m_pLocation = Locations.bathroom;
     }
 }
 public override void Enter(Miner miner)
 {
     if (miner.m_Location != Location.Saloon)
     {
         Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Boy, ah sure is thusty! Walkin' to the saloon.");
         miner.m_Location = Location.Saloon;
     }
 }
 public override void Enter(Wife wife)
 {
     if (!wife.Cooking())
     {
         Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Putting the stew in the oven");
         MessageDispatcher.Instance.DispatchMessage(1.5, wife.ID, wife.ID, msg_type.MSG_STEWREADY, MessageDispatcher.NO_ADDITIONAL_INFO);
         wife.SetCooking(true);
     }
 }
        public override void Enter(Miner miner)
        {
            if (miner.m_Location != Location.Shack)
            {
                Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Walkin' home.");
                miner.m_Location = Location.Shack;

                MessageDispatcher.Instance.DispatchMessage(MessageDispatcher.SEND_MSG_IMMEDIATELY, miner.ID, (int)EntityNameType.WIFE, msg_type.MSG_HIHONEYIMHOME, MessageDispatcher.NO_ADDITIONAL_INFO);
            }
        }
 public override void Execute(Miner miner)
 {
     if (miner.isFatigued())
     {
         miner.DecreaseFatigue();
         Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": ZZZZ...");
     }
     else
     {
         Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": What a God-darn fantastic nap! Time to find more gold.");
         miner.ChangeState(EnterMineAndDigForNugget.Instance);
     }
 }
 public override void Execute(Miner miner)
 {
     if (miner.isThirsty())
     {
         miner.BuyDrinksandWhiskey();
         Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": That's mighty fine sippin liquor.");
         miner.ReverttoPreviousState();
     }
     else
     {
         Console.WriteLine("WTF! THIS IS RESTRICTED AREA, NI@GA!");
     }
 }
 public override bool OnMessage(Wife wife, Telegram msg)
 {
     switch (msg.Msg)
     {
     case msg_type.MSG_STEWREADY:
         Console.WriteLine("Message received by " + EntityType.GetEntityName(wife.ID) + "at time " + CrudeTimer.Instance.GetCurrentTime());
         Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": StewReady! Lets eat.");
         MessageDispatcher.Instance.DispatchMessage(MessageDispatcher.SEND_MSG_IMMEDIATELY, wife.ID, (int)EntityNameType.MINER, msg_type.MSG_STEWREADY, MessageDispatcher.NO_ADDITIONAL_INFO);
         wife.SetCooking(false);
         wife.GetFSM().ChangeState(DoHousework.Instance);
         return(true);
     }
     return(false);
 }
 public override bool OnMessage(Wife wife, Telegram msg)
 {
     switch (msg.Msg)
     {
     case (int)msg_type.MSG_HIHONEYIMHOME:
     {
         Console.WriteLine("Message handled by " + EntityType.GetEntityName(wife.ID) + " at time: " + CrudeTimer.Instance.GetCurrentTime());
         Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Hi honey. Let me make you some of mah fine country stew");
         wife.GetFSM().ChangeState(CookStew.Instance);
         return(true);
     }
     }
     return(false);
 }
        public override void Execute(Miner miner)
        {
            miner.AddToGoldCarried(1);
            miner.IncreaseFatigue();
            Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Pickin' up a nugget.");

            if (miner.isPocketsFull())
            {
                miner.ChangeState(VisitBankAndDepositGold.Instance);
            }
            if (miner.isThirsty())
            {
                miner.ChangeState(QuenchThirst.Instacne);
            }
        }
        public override void Execute(Miner miner)
        {
            miner.DepositGoldInBank();
            Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Depositin’ gold. Total savings now: " + miner.MoneyInBank);

            if (miner.isWealthy())
            {
                Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Woohoo! Rich enough for now.Back home to mah li'l lady.");
                miner.ChangeState(GoHomeAndSleepTilRested.Instance);
            }
            else
            {
                miner.ReverttoPreviousState();
            }
        }
예제 #16
0
        public void DispatchDelayedMessage()
        {
            double CurrentTime = CrudeTimer.Instance.GetCurrentTime();
            var    numerator   = PriorityQ.GetEnumerator();

            while (numerator.MoveNext())
            {
                Telegram   telegram  = numerator.Current;
                BaseEntity pReciever = EntityMgr.GetEntityFromID(telegram.Reciever);

                Console.WriteLine("Queued telegram ready for dispatch: Sent to " + EntityType.GetEntityName(pReciever.ID) + ". Msg is " + MsgType.GetMsgName(telegram.Msg));

                Discharge(pReciever, telegram);
            }
            PriorityQ.Clear();
        }
 public override void Exit(Miner miner)
 {
     Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Leavin' the bank.");
     miner.ReverttoPreviousState();
 }
 public override void Enter(Miner miner)
 {
     Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Smells Reaaal goood Elsa!");
 }
 public override void Exit(Wife wife)
 {
     Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": : Puttin' the stew on the table.");
 }
 public override void Execute(Wife wife)
 {
     Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": : Fussin' over food.");
 }
 public override void Execute(Miner miner)
 {
     Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Tastes real good too!");
     miner.ReverttoPreviousState();
 }
 public override void Exit(Wife wife)
 {
     Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Leavin' the john");
 }
 public override void Execute(Wife wife)
 {
     Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Ahhhhhh! Sweet relief!");
     wife.ReverttoPreviousState();
 }
 public override void Exit(Miner miner)
 {
     Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Thankya li'lle lady. Ah better get back to whatever ah wuz doin'.");
 }
 public override void Exit(Miner miner)
 {
     Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Leaving the house.");
 }
 public override void Exit(Miner miner)
 {
     Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Leaving the saloon, feelin' good.");
 }
 public override void Exit(Wife wife)
 {
     Console.WriteLine(EntityType.GetEntityName(wife.ID) + ": Thats enough cleanin' for now.");
 }
 public override void Exit(Miner miner)
 {
     Console.WriteLine(EntityType.GetEntityName(miner.ID) + ": Ah'm leavin' the gold mine with mah pockets full o' sweet gold.");
 }