Ejemplo n.º 1
0
        /// <summary>
        /// Metoda koja proveruva dali daden neprijatel (es) e vo dopir so metak (b).
        /// </summary>
        /// <param name="es">Neprijatel (EnemyShip)</param>
        /// <param name="b">Metak (Bullet)</param>
        /// <returns>Rezultatot e "true" ako dvata objekti se vo dopir.</returns>
        private bool CheckHit(EnemyShip es, Bullet b)
        {
            if (b.Position.Y < -180)
            {
                b.Active = false;
                return(false);
            }
            bool x = es.Position.Y + 41 > b.Position.Y;
            bool y = (b.Position.X > es.Position.X - 8) && (b.Position.X < es.Position.X + 38);

            return(x && y);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gi brishe avionite shto se nadvor od vidliviot del.
 /// </summary>
 /// <param name="es">EnemyShip</param>
 /// <returns>Vrakaj "true" ako avionot e pod opredelenata granica.</returns>
 private bool CheckEnemy(EnemyShip es)
 {
     if (es.Position.Y > 550)
     {
         Player.RemoveHealth();
         if (Player.Health == 0)
         {
             Player.IsDead = true;
         }
         es.RemoveHealth();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Funkcija za generiranje na neprijateli.
        /// Prvo se generira kolku neprijateli.
        /// Potoa se stavat na random mesto i se dodavaat vo listata na neprijateli.
        /// </summary>
        public void GenerateEnemies()
        {
            int c    = Randomizer.Next(1, HowManyEnemies);
            int from = 0;

            if (c != 0)
            {
                from = 300 / c;
            }
            for (int i = 0; i < c; i++)
            {
                EnemyShip es = new EnemyShip(Randomizer.Next(i * from, (i + 1) * from), Randomizer.Next(-180, -20),
                                             Randomizer.Next(EnemySpeed - 1, EnemySpeed + 1));
                Enemies.Add(es);
            }
        }