Example #1
0
        public override GameState GetHit(GameStatus status, int points)
        {
            int currLivingPoints = status.GetLivingPoints() - points;

            status.SetLivingPoints(currLivingPoints);

            if (currLivingPoints < 10)
            {
                Console.WriteLine($"You have {currLivingPoints} living points - you move to danger state");

                return(new InDangerState());
            }
            else if (currLivingPoints <= 0)
            {
                Console.WriteLine("You have no living points - sorry you have lost");

                return(new LoseState());
            }
            else
            {
                Console.WriteLine($"You have { currLivingPoints} living points");

                return(new NewState());
            }
        }
Example #2
0
        public override GameState GetHit(GameStatus status, int points)
        {
            int currLivingPoints = status.GetLivingPoints() - points;

            status.SetLivingPoints(currLivingPoints);

            if (currLivingPoints <= 0)
            {
                Console.WriteLine("Your'e out of living points, GAME OVER");

                return(new LoseState());
            }
            else
            {
                Console.WriteLine($"You have lost living points - you now have {currLivingPoints}");

                return(new InDangerState());
            }
        }