예제 #1
0
        public List <Asteroid> Destroy()
        {
            List <Asteroid> result = new List <Asteroid>();

            ToRemove = true;
            AsteroidDestroyed?.Invoke(this, new EventArgs());
            Remove();
            if (_asteroidSize != 1)
            {
                Asteroid a1 = new Asteroid(_grid, _pos.Copy(), _vec.Copy(), asteroidSize: (byte)(_asteroidSize - 1));

                Position p2 = _pos.Copy();
                p2.X += DefaultSize;
                p2.Y += DefaultSize;
                PRandom pr = new PRandom();
                GBsharp2.Primitives.Vector v2 = new GBsharp2.Primitives.Vector(pr.Next((int)(-AsteroidsDefaultSpeed * 2), (int)(-AsteroidsDefaultSpeed)), pr.Next((int)(-AsteroidsDefaultSpeed / 2), (int)(AsteroidsDefaultSpeed / 2)));
                Asteroid a2 = new Asteroid(_grid, p2, v2, asteroidSize: (byte)(_asteroidSize - 1));

                result.Add(a1);
                result.Add(a2);
            }
            return(result);
        }
예제 #2
0
 public Missile(Grid grid, Position pos, GBsharp2.Primitives.Vector vec, double size = 1.0) : base(grid, pos, vec, size)
 {
 }
예제 #3
0
 public Player(Grid grid, Position pos, GBsharp2.Primitives.Vector vec, double size = 1.0) : base(grid, pos, vec, size)
 {
     Missiles = new List <Missile>();
     HP       = 10;
 }
예제 #4
0
 public Asteroid(Grid grid, Position pos, GBsharp2.Primitives.Vector vec, byte asteroidSize, double size = 1.0) : base(grid, pos, vec, size)
 {
     _asteroidSize = asteroidSize;
 }