Exemplo n.º 1
0
        public void MangePlayer()
        {
            string CurrentcellDes = player.Currentcell.CellDescription = "Golden Box";

            box = new GoldenBox();
            if (CurrentcellDes == box.GetBoxType() && box.GetBoxType() == "Golden Box")
            {
                context = new Context(new GoldenBox());
                player.PlayerBoxs.Add(box.GetBoxType());
                foreach (string K in player.PlayerKeys)
                {
                    string k = K;
                    if (k == "Golden key")
                    {
                        context.executeStrategy();
                    }
                }
            }

            else if (CurrentcellDes == "Silver Box")
            {
                context = new Context(new SilverBox());
                player.PlayerBoxs.Add(box.GetBoxType());
                foreach (string K in player.PlayerKeys)
                {
                    string k = K;
                    if (k == "Silver key")
                    {
                        context.executeStrategy();
                    }
                }
            }
            else if (CurrentcellDes == "Bronze Box")
            {
                context = new Context(new BronzeBox());
                player.PlayerBoxs.Add(box.GetBoxType());
                foreach (string K in player.PlayerKeys)
                {
                    string k = K;
                    if (k == "Bronze Key")
                    {
                        context.executeStrategy();
                    }
                }
            }
            else if (CurrentcellDes == key.GetkeyType() && key.GetkeyType() == "Golden key")
            {
                key = new GoldenKey();
                player.PlayerKeys.Add(key.GetkeyType());
            }
            else if (CurrentcellDes == "Silver key")
            {
                key = new Silverkey();
                player.PlayerKeys.Add(key.GetkeyType());
            }
            else if (CurrentcellDes == "Bronze Key")
            {
                key = new BronzeKey();
                player.PlayerKeys.Add(key.GetkeyType());
            }
            else if (CurrentcellDes == enemy.Type())
            {
                enemy.ExecuteEnemyStrategy();
            }
            else if (CurrentcellDes == diamond.getType())
            {
                Console.WriteLine("Congratulation You are The winner");
            }
            else
            {
                Console.WriteLine(" Exit ");
            }
        }