Esempio n. 1
0
 public bool IsValid() => Bomb1.IsBoundWith(Bomb2);
Esempio n. 2
0
        internal void update(GameTime gameTime)
        {
            timer += (float)gameTime.ElapsedGameTime.TotalSeconds;


            if (timer >= timecounter)
            {
                Shuffle(lineID);
                Shuffle(colID);

                DefaultEntity temp;

                Random            rndn           = new Random(DateTime.Now.Millisecond);
                int               acum           = 0;
                AbstractBehaviour levelBehaviour = GameModel.levelsModels.ElementAt(GameModel.currentLevelID).behaviour;
                for (int i = 0; i < 5; i++)
                {
                    float rnd = rndn.Next(0, 35);
                    acumSpecial--;
                    if (acumSpecial <= 0)
                    {
                        temp = null;
                        RufusModel tempModel = GameModel.getStarByFrequency();
                        if (tempModel != null)
                        {
                            if (tempModel.behaviour is SimpleStarBehaviour)
                            {
                                temp            = new Star(10);
                                temp.position.X = colID[acum] * 80;
                                temp.position.Y = lineID[acum] * 60;
                            }
                            else if (tempModel.behaviour is MagneticStarBehaviour || tempModel.behaviour is RainStarBehaviour || tempModel.behaviour is TimeStarBehaviour)
                            {
                                temp            = new DefaultMooshroom(0, tempModel.behaviour, false, rufus);
                                temp.position.X = colID[acum] * 80;
                                temp.position.Y = lineID[acum] * 60;
                            }
                        }
                        acumSpecial = (int)(10 + rndn.NextDouble() * 40);
                    }
                    else if (rnd < 4 + levelBehaviour.frequency)
                    {
                        LevelBehaviour tempBehaviour = levelBehaviour as LevelBehaviour;

                        if (tempBehaviour.enemy == 1)
                        {
                            temp = new Bomb1(colID[acum] * 80, (int)((float)rndn.NextDouble() * 30 - 30f));
                        }
                        else if (tempBehaviour.enemy == 2)
                        {
                            temp = new BerryBomb(colID[acum] * 80, (int)((float)rndn.NextDouble() * 30 - 30f));
                        }
                        else if (tempBehaviour.enemy == 3)
                        {
                            temp = new JackO(colID[acum] * 80, (int)((float)rndn.NextDouble() * 30 - 30f));
                        }
                        else if (tempBehaviour.enemy == 4)
                        {
                            temp = new Hells(colID[acum] * 80, (int)((float)rndn.NextDouble() * 30 - 30f));
                        }
                        else if (tempBehaviour.enemy == 5)
                        {
                            temp = new CloudEye(colID[acum] * 80, (int)((float)rndn.NextDouble() * 30 - 30f));
                        }
                        else if (tempBehaviour.enemy == 6)
                        {
                            temp = new Goomba(colID[acum] * 80, (int)((float)rndn.NextDouble() * 30 - 30f));
                        }
                        else
                        {
                            temp = new Bomb1(colID[acum] * 80, (int)((float)rndn.NextDouble() * 30 - 30f));
                        }

                        temp.position.Y = -60;
                    }
                    else if (rnd < 7 + levelBehaviour.frequency)
                    {
                        RufusModel tempModel = GameModel.getBolinhaByFrequency();
                        if (tempModel != null)
                        {
                            if (tempModel.behaviour is GreenBolinhaBehaviour)
                            {
                                temp            = new Bolinha(colID[acum] * 80);
                                temp.position.Y = -50;
                            }
                            else if (tempModel.behaviour is RedBolinhaBehaviour)
                            {
                                temp = new BolinhaVermelha(colID[acum] * 80);
                            }
                            else if (tempModel.behaviour is JumpBolinhaBehaviour)
                            {
                                temp = new BolinhaPulante(colID[acum] * 80);
                            }
                            else
                            {
                                temp            = new BolinhaQuicante(colID[acum] * 80);
                                temp.position.Y = -50;
                            }
                        }
                        else
                        {
                            temp = null;
                        }
                    }
                    //else if (rnd < 8 + levelBehaviour.frequency)
                    //{
                    //    temp = null;
                    //    RufusModel tempModel = GameModel.getStarByFrequency();
                    //    if (tempModel != null)
                    //    {
                    //        if (tempModel.behaviour is SimpleStarBehaviour)
                    //        {
                    //            temp = new Star(10);
                    //            temp.position.X = colID[acum] * 80;
                    //            temp.position.Y = lineID[acum] * 60;
                    //        }
                    //        else if (tempModel.behaviour is MagneticStarBehaviour || tempModel.behaviour is RainStarBehaviour || tempModel.behaviour is TimeStarBehaviour)
                    //        {
                    //            temp = new DefaultMooshroom(0, tempModel.behaviour, false, rufus);
                    //            temp.position.X = colID[acum] * 80;
                    //            temp.position.Y = lineID[acum] * 60;
                    //        }
                    //    }
                    //}
                    else
                    {
                        // temp = new DefaultMooshroom(0, GameModel.itensModels.ElementAt(1).behaviour);
                        temp = new DefaultMooshroom(0, GameModel.getMushroomByFrequency().behaviour, false, rufus);

                        temp.position.X = colID[acum] * 80;
                        temp.position.Y = lineID[acum] * 60;
                    }


                    if (temp != null)
                    {
                        entityLayer.add(temp);
                        entityLayer.init(content);
                    }

                    timer = 0f;

                    acum++;
                }
            }
        }