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++; } }
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 }; } }
public void Move() { for (var i = 0; i < _rocks.Length; i++) { if (!_rocks[i].IsVisible) { continue; } _rocks[i].Move(); GameOfMeteors.ApplyToreGeometry(_rocks[i]); } }
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++; } }
/// <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(); }