Ejemplo n.º 1
0
    public void Enfileira(Bolinha novaBola)
    {
        ElementoBola novoElemento = new ElementoBola(novaBola);

        ultimo.proximo = novoElemento;
        ultimo         = novoElemento;
    }
Ejemplo n.º 2
0
    public void atiraBola()
    {
        if (bolaFixa.activeSelf)
        {
            Bolinha bolaux = filaDeBolas.Desenfileira();
            if (bolaux != null)
            {
                bolaux.transform.position = this.transform.position;//set position
                bolaux.gameObject.SetActive(true);

                bolaux.GetComponent <Rigidbody>().AddForce(direcaoTiro, ForceMode.Acceleration);//Shoot it

                nBolasGame++;
                nBolasFilaAtual--;
                cooldown -= cooldownMax;
            }
            else
            {
                semBola.Play();//controlador de audio
            }
        }

        direcaoTiro.y = velocidadeInicial;
    }
Ejemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     meuGameStatus = FindObjectOfType <GameStatus>();
     minhaBolinha  = FindObjectOfType <Bolinha>();
 }
Ejemplo n.º 4
0
 public ElementoBola(Bolinha novaBola)
 {
     minhaBola = novaBola;
     proximo   = null;
 }
Ejemplo n.º 5
0
 public void atualizar(Bolinha dado)
 {
     nBolasGame--;
     notificarObservadores();
 }
Ejemplo n.º 6
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++;
                }
            }
        }