Esempio n. 1
0
        public Meteor(GameOfMeteors game, int index, int x, int y)
        {
            _rnd = new Random();
            var speed = GetRandomSpeed();
            var j     = 0;
            var skip  = _rnd.Next(4);

            for (var i = 0; i < 4; i++)
            {
                if (i == skip)
                {
                    continue;
                }
                _rockXOffsets[j] = _rockOffsets[i * 2];
                _rockYOffsets[j] = _rockOffsets[i * 2 + 1];
                _rocks[j]        = new PlayerMissile {
                    Name            = "Meteor" + index + ":" + j,
                    X               = x + _rockXOffsets[j],
                    Y               = y + _rockYOffsets[j],
                    HorizontalSpeed = speed.X,
                    VerticalSpeed   = speed.Y,
                    Owner           = game.World
                };
                j++;
            }
        }
Esempio n. 2
0
 public Meteor(GameOfMeteors game, int index) {
     Owner = game;
     Index = index;
     for (var i = 0; i < 3; i++) {
         _rocks[i] = new PlayerMissile {
                                           Name = "Meteor" + index + ":" + i,
                                           IsVisible = false,
                                           Owner = game.World,
                                           IsEnemy = true
                                       };
     }
 }
Esempio n. 3
0
 public void Move()
 {
     for (var i = 0; i < _rocks.Length; i++)
     {
         if (!_rocks[i].IsVisible)
         {
             continue;
         }
         _rocks[i].Move();
         GameOfMeteors.ApplyToreGeometry(_rocks[i]);
     }
 }
Esempio n. 4
0
 public Meteor(GameOfMeteors game, int index)
 {
     Owner = game;
     Index = index;
     for (var i = 0; i < 3; i++)
     {
         _rocks[i] = new PlayerMissile {
             Name      = "Meteor" + index + ":" + i,
             IsVisible = false,
             Owner     = game.World,
             IsEnemy   = true
         };
     }
 }
Esempio n. 5
0
 public Meteor(GameOfMeteors game, int index, int x, int y) {
     _rnd = new Random();
     var speed = GetRandomSpeed();
     var j = 0;
     var skip = _rnd.Next(4);
     for (var i = 0; i < 4; i++) {
         if (i == skip) continue;
         _rockXOffsets[j] = _rockOffsets[i*2];
         _rockYOffsets[j] = _rockOffsets[i*2 + 1];
         _rocks[j] = new PlayerMissile {
                                           Name = "Meteor" + index + ":" + j,
                                           X = x + _rockXOffsets[j],
                                           Y = y + _rockYOffsets[j],
                                           HorizontalSpeed = speed.X,
                                           VerticalSpeed = speed.Y,
                                           Owner = game.World
                                       };
         j++;
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Entry point called by the ConsoleBootLoader project
        /// </summary>
        /// <param name="args">Array of object references to the hardware features</param>
        public static void Run(object[] args)
        {
            var thread = new GameOfMeteors(new ConsoleHardwareConfig(args)).Run();

            thread.Join();
        }
Esempio n. 7
0
 /// <summary>
 /// Entry point called by the ConsoleBootLoader project
 /// </summary>
 /// <param name="args">Array of object references to the hardware features</param>
 public static void Run(object[] args) {
     var thread = new GameOfMeteors(new ConsoleHardwareConfig(args)).Run();
     thread.Join();
 }