Beispiel #1
0
        /// <summary>
        /// Пересечение границы экрана
        /// </summary>
        virtual public void CrossingEdge()
        {
            Edge edge   = GetCrossedBound();
            var  window = Avalon.GetGameInstance().Window();

            if (edge != Edge.NULL)
            {
                if (edge == Edge.LEFT)
                {
                    e.Position = new Vector2f(window.Size.X + e.Size, e.Position.Y);
                }
                else if (edge == Edge.RIGHT)
                {
                    e.Position = new Vector2f(-e.Size, e.Position.Y);
                }
                else if (edge == Edge.UP)
                {
                    e.Position = new Vector2f(e.Position.X, window.Size.Y + e.Size);
                }
                else
                {
                    e.Position = new Vector2f(e.Position.X, -e.Size);
                }
            }
        }
Beispiel #2
0
        public override Shot Shoot(Vector2f gunPosition, Vector2f speed, float rotation)
        {
            Projectile proj = new Projectile(gunPosition, speed, rotation);

            isWeaponCharged = false;
            lastShotTime    = Avalon.GetGameInstance().GameTimer().ElapsedMilliseconds;
            return(proj);
        }
Beispiel #3
0
 public static Avalon GetGameInstance(uint width, uint height, String title, Color clrColor)
 {
     if (avalonInstance == null)
     {
         avalonInstance = new Avalon(width, height, title, clrColor);
     }
     return(avalonInstance);
 }
Beispiel #4
0
        public override void Charge(Object stateInfo)
        {
            var gameTime = Avalon.GetGameInstance().GameTimer().ElapsedMilliseconds;

            if (gameTime - lastShotTime >= shotChargingTime)
            {
                isWeaponCharged = true;
            }
        }
Beispiel #5
0
 public Avalon Produce(byte Type)
 {
     Avalon Pizza = new Avalon(Data[Type], Attach, Detach, Router, Type);
     Pizza.fill = Fill;
     (Pizza.RenderTransform as CompositeTransform).TranslateX = DefaultLocation.X;
     (Pizza.RenderTransform as CompositeTransform).TranslateY = DefaultLocation.Y;
     FactoredItems.Add(Pizza);
     return Pizza;
 }
Beispiel #6
0
        public override void Charge(Object stateInfo)
        {
            var gameTime = Avalon.GetGameInstance().GameTimer().ElapsedMilliseconds;

            if (laserReserve < laserLifetime)
            {
                laserReserve += (gameTime - lastTime) / 3;
            }
            lastTime = gameTime;
        }
Beispiel #7
0
 /// <summary>
 /// Получение границы экрана, которую пересекли
 /// </summary>
 virtual public Edge GetCrossedBound()
 {
     if ((e.Position.X + e.Size) < 0.0)
     {
         return(Edge.LEFT);
     }
     else if ((e.Position.X - e.Size) > Avalon.GetGameInstance().Window().Size.X)
     {
         return(Edge.RIGHT);
     }
     else if ((e.Position.Y + e.Size) < 0)
     {
         return(Edge.UP);
     }
     else if ((e.Position.Y - e.Size) > Avalon.GetGameInstance().Window().Size.Y)
     {
         return(Edge.DOWN);
     }
     else
     {
         return(Edge.NULL);
     }
 }
Beispiel #8
0
 public void Delete(Avalon A)
 {
     FactoredItems.Remove(A);
 }
Beispiel #9
0
        static void Main(string[] args)
        {
            Avalon asteroidGame = Avalon.GetGameInstance(1920, 1500, "Asteroids", Color.Black);

            asteroidGame.Run();
        }