Пример #1
0
        public override GameState GetHit(GameStatus status, int points)
        {
            int currLivingPoints = status.GetLivingPoints() - points;

            status.SetLivingPoints(currLivingPoints);
            if (currLivingPoints <= 0)
            {
                Console.WriteLine("You have lost, because you lost all your living points.");
                return(new LoseState());
            }
            else
            {
                Console.WriteLine("You have changed to danger state, because you have: " + currLivingPoints + " living points.");
                return(new DangerState());
            }
        }
Пример #2
0
        public override GameState GetHit(GameStatus status, int points)
        {
            int currLivingPoints = status.GetLivingPoints() - points;

            status.SetLivingPoints(currLivingPoints);
            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 - you move to danger state");
                return(new DangerState());
            }
        }