Example #1
0
 public GameState()
 {
     gameObjects  = new List <GameObject>();
     random       = new Random();
     fruitFactory = new FruitFactory();
     bonusFactory = new BonusFactory();
 }
Example #2
0
        public GameSession(TileSet tileSet, int maxPlayersAllowed,
                           GameMode gameType, int gameID, int teams)
        {
            //	SessionTeamsList = new TeamsList();

            for (int i = 1; i <= teams; i++)
            {
                _sessionTeamsList.Teams.Add(new Team(i));
            }

            IsStarted = false;
            GameLevel = new GameLevel(Constants.LEVEL_WIDTH, Constants.LEVEL_HEIGHT, tileSet);

            var playerNames = new List <string>();

            _gameObjects = new List <AGameObject>();
            _newObjects  = new List <AGameObject>();

            LocalGameDescription = new GameDescription(playerNames, maxPlayersAllowed, gameType, gameID, tileSet, teams);
            if (gameType == GameMode.Deathmatch)
            {
                _spiderFactory = new DeathmatchSpiderFactory(GameLevel);
            }
            else
            {
                _spiderFactory = new DefaultSpiderFactory(GameLevel);
            }
            _bonusFactory = new BonusFactory();
            _wallFactory  = new WallFactory(GameLevel);
        }
Example #3
0
        public bool SaveService(CommonBonusModel bonus)
        {
            var actionBonus = new BonusFactory().CreateBonusFactory(bonus.Type, _conn);

            switch (bonus.Type)
            {
            case Enum.BonusTypeEnum.WelcomeBonus:
                return(actionBonus.SaveBonus(new WelcomeBonusModel {
                    BonusId = 1, WelcomeBonusId = 1
                }));
            }

            return(false);
        }
Example #4
0
        static void Main(string[] args)
        {
            ProductSystem           productSystem    = new ProductSystem();
            ClientSystem            clientSystem     = new ClientSystem();
            ProductAdapter          productAdapter   = new ProductAdapter();
            BillingStatisticsSystem statisticsSystem = new BillingStatisticsSystem(productAdapter);
            BonusFactory            bonusFactory     = new BonusFactory();

            Client client1 = new Client("Ina", "Munteanu", new DateTime(1996, 1, 1));

            clientSystem.AddClient(client1);
            Client client2 = new Client("Maria", "Zeru", new DateTime(1997, 1, 1));

            clientSystem.AddClient(client2);


            Product product1 = new Product();

            product1.Name  = "name1";
            product1.Price = 8;
            product1.DoP   = DateTime.Now;
            productSystem.AddProduct(product1);

            Product product2 = new Product();

            product2.Name  = "name2";
            product2.Price = 12;
            product2.DoP   = DateTime.Now;

            //Decorator
            LimitedEditionProduct limitedEditionProduct1 = new LimitedEditionProduct(product2);

            limitedEditionProduct1.EndOfPromotion = new DateTime(2020, 1, 1);
            productSystem.AddProduct(limitedEditionProduct1);

            Product product3 = new Product();

            product3.Name  = "name3";
            product3.Price = 3;
            product3.DoP   = DateTime.Now;
            productSystem.AddProduct(product3);


            //Flyweight
            Console.WriteLine("\nFlyweight:");
            IBonus bonus = bonusFactory.GetBonus("PrimeUserBonus");

            bonus.AddBonus(client2);
            client2.ShowDiscountData();


            //Bridge
            Console.WriteLine("\nBridge:");
            //client1.ShowPersonalData();
            //client1.EditPersonalData();
            //client1.ShowPersonalData();


            //Adapter
            Console.WriteLine("\nAdapter:");
            statisticsSystem.ShowProductsNameList();
            statisticsSystem.ShowAveragePrice();

            //Decorator
            Console.WriteLine("\nDecorator:");
            limitedEditionProduct1.ShowData();


            //Facade
            Console.WriteLine("\nFacade:");
            //client1.SetClientDiscountStatus();
            bonus.AddBonus(client1);
            client1.AddToCart(product1);
            client1.AddToCart(limitedEditionProduct1);
            client1.TopUpAccount(21);
            client1.GetThePurchaseInfo();
            client1.Purchase();

            //client1.ShowBallanceData();


            Console.ReadKey();
        }
Example #5
0
 private void Start()
 {
     triggerSphere = GetComponentInChildren <BoxInteract>();
     bonus         = BonusFactory.Create();
 }