Exemple #1
0
        private void CreatingFruits()
        {
            creatorCounterPoints++;
            // this is around 4 seconds.
            if (creatorCounterPoints == creatorCounterMax)
            {
                creatorCounterPoints = 0;
                // we need to think where to put Tom and the state of bombing. I guess with a boolean bombing and every 30 seconds or so to make it true and if it is not bombing to do this below if it is bombing we are going to run another code.
                if (random.Next(10) > 8)
                {
                    Bonus timeBonus = bonusFactory.CreateBonus("TimeBonus");
                    timeBonus.LoadContent();
                    gameObjects.Add(timeBonus);
                }
                else
                {
                    // fruit
                    switch (random.Next(6))
                    {
                    case 0:
                        Consumable fruitStrawberry = fruitFactory.CreateFruit("Strawberry");
                        fruitStrawberry.LoadContent();
                        gameObjects.Add(fruitStrawberry);
                        break;

                    case 1:
                        Consumable fruitCherry = fruitFactory.CreateFruit("Cherry");
                        fruitCherry.LoadContent();
                        gameObjects.Add(fruitCherry);
                        break;

                    case 2:
                        Consumable fruitCheese = fruitFactory.CreateFruit("Cheese");
                        fruitCheese.LoadContent();
                        gameObjects.Add(fruitCheese);
                        break;

                    case 3:
                        Consumable fruitCake = fruitFactory.CreateFruit("Cake");
                        fruitCake.LoadContent();
                        gameObjects.Add(fruitCake);
                        break;

                    case 4:
                        Consumable fruitMuffin = fruitFactory.CreateFruit("Muffin");
                        fruitMuffin.LoadContent();
                        gameObjects.Add(fruitMuffin);
                        break;

                    case 5:
                        Consumable fruitSalami = fruitFactory.CreateFruit("Salami");
                        fruitSalami.LoadContent();
                        gameObjects.Add(fruitSalami);
                        break;

                    default: break;
                    }
                }
            }
        }
Exemple #2
0
        protected IEnumerable <AGameEvent> MobDead(AGameObject mob, long time)
        {
            var events = new List <AGameEvent>();

            //SomebodyDied(mob);
            //mob.MeMoved -= SomebodyMoved;
            if ((mob.Is(AGameObject.EnumObjectType.LivingObject)) && !mob.Is(AGameObject.EnumObjectType.Poisoning) && !mob.Is(AGameObject.EnumObjectType.Turret) && !mob.Is(AGameObject.EnumObjectType.Caterpillar))
            {
                AGameBonus gameBonus = _bonusFactory.CreateBonus(mob.Coordinates);
                gameBonus.IsActive = true;
                events.AddRange(NewBonusDropped(gameBonus, time));
            }

            if (mob.Is(AGameObject.EnumObjectType.Player))
            {
                PlayerDead(mob as MainSkyShootService);
            }
            events.Add(new ObjectDeleted(mob.Id, _timeHelper.GetTime()));
            // will be delete later
            //_gameObjects.Remove(mob);
            return(events);
        }