Exemplo n.º 1
0
 public void UpdateLupoCattivo()
 {
     if (lc != null && (lc.Coord.X > 800 || lc.Coord.Y > 480))
       {
     lc = null;
     attentiAlLupo = false;
       }
       else
     lc.UpdateLupo();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public void TouchInput(GameTime gt)
        {
            TouchCollection tc = TouchPanel.GetState();

              if (!attentiAlLupo)
            foreach (TouchLocation tl in tc)
            {
              if (tl.Position != Vector2.Zero && !ilVecchioContiene(tl))
              {
            NuvolaGen toRemovePecora;
            {
              toRemovePecora = IntersectElemento(tl);

              if (toRemovePecora != null)
              {
                int quale = listaElementi.IndexOf(toRemovePecora);
                listaElementi[quale].Touched = true;

                if (toRemovePecora.IsPecora)
                {
                  pecoreInFila++;
                  punti += 10;
                  boomAudio.Play();
                  if (pecoreInFila == nextBonus)
                  {
                    punti += nextBonus;
                    bonusPecora = new Bonus(nextBonus, (float)gt.TotalGameTime.TotalMilliseconds + 2500);
                    nextBonus *= 2;
                    achiAudio.Play();
                  }
                }
                else if (vite >= 0)
                {
                  vite--;
                  pecoreInFila = 0;
                  nextBonus = 15;
                  if (vite >= 0)
                  {
                    for (int i = 0; i < listaElementi.Count; i++)
                      if (listaElementi[i].IsPecora)
                        listaElementi[i].ScappaDalLupoCattivo(rand.Next(8, 11));
                    lc = new LupoCattivo();
                    wolfAudio.Play();
                    attentiAlLupo = true;
                  }
                }

              }
            }
              }
            }

              _oldPanel = tc;
        }