/// <summary>
        /// Runs when the state is entered.
        /// Changes the location to GoldMine
        /// </summary>
        /// <param name="miner">The miner.</param>
        public void Enter(Miner miner)
        {
            // we are already at the gold mine, do nothing
            if (miner.LocationType == LocationType.GoldMine)
            {
                return;
            }

            Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: Walkin' to the gold mine!");
            miner.LocationType = LocationType.GoldMine;
        }
Exemple #2
0
        public void Enter(Miner miner)
        {
            // if we already at the saloon don't do anything
            if (miner.LocationType == LocationType.Saloon)
            {
                return;
            }

            miner.LocationType = LocationType.Saloon;
            Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: Boy, ah sure is thusty. Walkin' to the saloon");
        }
        public void Enter(Miner miner)
        {
            // if we are alreay at the bank we don't need to change locations, just return
            if (miner.LocationType == LocationType.Bank)
            {
                return;
            }

            Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: Goin' to the bank. Yes siree!");
            miner.LocationType = LocationType.Bank;
        }
Exemple #4
0
        public void Enter(Miner miner)
        {
            if (miner.LocationType == LocationType.Shack)
            {
                return;
            }

            Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: Walkin' Home");
            miner.LocationType = LocationType.Shack;

            // let the wife know I'm home
            MessageDispatcher.SendMessage(MessageDispatcher.SendMessageImmediately, miner.Id, (int)Entity.Elsa, (int)MessageType.MsgHiHoneyImHome, null);
        }
Exemple #5
0
 public void Execute(Miner miner)
 {
     // we are still thirsty
     if (miner.IsThirsty)
     {
         miner.BuyAndDrinkWhiskey();
         Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: That's mighty fine sippin' liquer");
         miner.StateMachine.ChangeState(EnterMineAndDigForNugget.Instance);
     }
     else
     {
         Console.Write("\nERROR! \nERROR! \nERROR!");
     }
 }
Exemple #6
0
        public void Enter(MinersWife entityType)
        {
            // we are already cooking do nothing
            if (entityType.IsCooking)
            {
                return;
            }

            Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Puttin' the stew in the oven");

            // delayed message to myself to remind to take stew out
            MessageDispatcher.SendMessage(0.000001, entityType.Id, entityType.Id, (int)MessageType.MsgStewReady, null);

            entityType.IsCooking = true;
        }
Exemple #7
0
 public void Execute(Miner miner)
 {
     // if the miner is not fatigued go ahead and start digging again
     if (!miner.IsFatigued)
     {
         Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: What a God Darn fantastic nap! Time to find more gold!");
         miner.StateMachine.ChangeState(EnterMineAndDigForNugget.Instance);
     }
     else
     {
         // we are still sleeping
         miner.DecreaseFatigue();
         Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: zzZZzz");
     }
 }
Exemple #8
0
        public bool OnMessage(Miner entity, Telegram telegram)
        {
            Console.ForegroundColor = ConsoleColor.Red;

            switch ((MessageType)telegram.MessageType)
            {
            case MessageType.MsgStewReady:
                Console.Write($"\nMessage handled by {Constants.GetNameOfEntity((Entity) entity.Id)} at {DateTime.Now:h:mm:ss tt zz}");
                Console.Write($"\n{Constants.GetNameOfEntity((Entity) entity.Id)}: Okay Hun, ahm a comin'!");
                entity.StateMachine.CurrentState = EatStew.Instance;
                return(true);

            default:
                return(false);
            }
        }
Exemple #9
0
        public bool OnMessage(MinersWife entity, Telegram telegram)
        {
            Console.BackgroundColor = ConsoleColor.Red;
            Console.ForegroundColor = ConsoleColor.Green;

            switch ((MessageType)telegram.MessageType)
            {
            case MessageType.MsgHiHoneyImHome:
                Console.Write($"\nMessage handled by {Constants.GetNameOfEntity((Entity) entity.Id)} at time: {DateTime.Now:t}");
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write($"\n{Constants.GetNameOfEntity((Entity) entity.Id)}: Hi honey. Let me make you some mah fine country stew");
                entity.StateMachine.ChangeState(CookStew.Instance);
                return(true);
            }

            return(false);
        }
        public void Execute(Miner miner)
        {
            // we need to deposit gold
            miner.AddToWealth(miner.GoldCarried);
            miner.GoldCarried = 0;

            Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: Depositing Gold. Total Savings Now: {miner.Wealth}");
            // can we earn a rest yet?
            if (miner.Wealth >= Constants.ComfortLevel)
            {
                Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: WoooHoo! Rich enough for now! Back home to mah lil' lady!");
                miner.StateMachine.ChangeState(GoHomeAndSleepTillRested.Instance);
            }
            else
            {
                miner.StateMachine.ChangeState(EnterMineAndDigForNugget.Instance);
            }
        }
Exemple #11
0
        public void Execute(MinersWife entityType)
        {
            var random = new Random();

            switch (random.Next(0, 3))
            {
            case 0:
                Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Moppin' the floor");
                break;

            case 1:
                Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Washin' the dishes");
                break;

            case 2:
                Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Makin' the bed");
                break;
            }
        }
        /// <summary>
        /// Runs when a state is updated.
        /// Digs forgold until tired or has enough nuggets.
        /// </summary>
        /// <param name="miner">The miner.</param>
        public void Execute(Miner miner)
        {
            // miner needs to dig for gold until he is carrying too much
            // if he gets tired he stops and changes states
            miner.AddToGoldCarried(1);
            miner.IncreaseFatigue();

            Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: Pickin' up a nugget!");

            // enough gold go to the bank
            if (miner.IsPocketsFull)
            {
                miner.StateMachine.ChangeState(VisitBankAndDepositGold.Instance);
            }

            // thirsty go and get whiskey
            if (miner.IsThirsty)
            {
                miner.StateMachine.ChangeState(QuenchThirst.Instance);
            }
        }
Exemple #13
0
        public bool OnMessage(MinersWife entity, Telegram telegram)
        {
            Console.ForegroundColor = ConsoleColor.Blue;

            switch ((MessageType)telegram.MessageType)
            {
            case MessageType.MsgStewReady:
                Console.Write($"\nMessage received by {Constants.GetNameOfEntity((Entity) entity.Id)} at time: {DateTime.Now:h:mm:ss tt zz}");
                Console.Write($"\n{Constants.GetNameOfEntity((Entity) entity.Id)}: StewReady! Lets eat!!");

                // let the hubby know the stew is ready
                MessageDispatcher.SendMessage(MessageDispatcher.SendMessageImmediately, entity.Id, (int)Entity.MinerBob, (int)MessageType.MsgStewReady, null);
                entity.IsCooking = false;
                entity.StateMachine.CurrentState = DoHouseWork.Instance;
                return(true);

            case MessageType.MsgHiHoneyImHome:
            default:
                return(false);
            }
        }
 public void Execute(MinersWife entityType)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Ahhhhhh! Sweet relief!");
     entityType.StateMachine.RevertToPreviousState();
 }
 public void Enter(MinersWife entityType)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Walkin' to the can. Need to powda mah prett li'lle nose");
 }
Exemple #16
0
 public void Exit(Miner entityType)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Thankya hun! Ahh better get back to watever ahh wuz doin!");
 }
Exemple #17
0
 public void Execute(Miner entityType)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Tastes real good too!");
     entityType.StateMachine.RevertToPreviousState();
 }
Exemple #18
0
 public void Exit(MinersWife entityType)
 {
     Console.ForegroundColor = ConsoleColor.Green;
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Puttin' the stew on the table");
 }
Exemple #19
0
 public void Execute(MinersWife entityType)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Fussin' over food");
 }
 public void Exit(MinersWife entityType)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Leavin' the Jon");
 }
Exemple #21
0
 public void Enter(MinersWife entityType)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Time to do some more housework!");
 }
Exemple #22
0
 public void Exit(Miner miner)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: leavin' the saloon, feelin' good");
 }
 /// <summary>
 /// Runs when state will exit.
 /// </summary>
 /// <param name="miner">The miner.</param>
 public void Exit(Miner miner)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: Ah'm leavin' the gold mine with mah pockets full o' sweet gold!");
 }
 public void Exit(Miner miner)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)miner.Id)}: Leavin' the bank");
 }
Exemple #25
0
 public void Enter(Miner entityType)
 {
     Console.Write($"\n{Constants.GetNameOfEntity((Entity)entityType.Id)}: Smells Reaaal good Elsa");
 }