public AirplanePhysicalModel(Airplane airplane, IAirplaneCommands commands) { _commands = commands; _airplane = airplane; Tanks = new List<Tank>(); Thrusters = new List<Thruster>(); Integrator = new Rk4Integrator<State>(CalculateDerivedState); }
public Airplane(World world, State state, Game game, Renderer renderer, bool isPlayer, Airplane playerPlane, String name, String modelName) : base(game, renderer, isPlayer ? -1000 : 0) { IsPlayer = isPlayer; World = world; CurrentState = state; Name = name; ModelName = modelName; if (isPlayer) Commands = new PlayerAirplaneCommands(game.Input); else Commands = new ComputerAirplaneCommands(); PhysicalModel = new AirplanePhysicalModel(this, Commands); Model = new ObjModel(renderer.DirectX.Device, "Airplane.obj", Renderer.TextureManager.Create("Metal.png")); if(!isPlayer && ConfigurationManager.Config.DisplayOverlay) game.Register(new AirplaneOverlay(game, renderer, this, playerPlane)); }
public static Airplane Create(World world, Game game, Renderer renderer, bool isPlayer = false, Airplane playerPlane = null) { if(random == null) random = new Random(); State state; if (isPlayer) state = new State(510, 200); else state = new State(200 + random.Next(-1000,2000), random.Next(-1500,1500), 500 + random.Next(0, 1000), 200+ random.Next(0,100), random.Next(-15,15)); Airplane plane = new Airplane(world, state, game, renderer, isPlayer, playerPlane, "F-14", "Plane " + i++); plane.PhysicalModel.Tanks.Add(new Tank(100, 500)); plane.PhysicalModel.Tanks.Add(new Tank(100, 500)); plane.PhysicalModel.Thrusters.Add(new Thruster()); plane.CurrentState.Position = new Vector3D(plane.CurrentState.Position.X - 2500, plane.CurrentState.Position.Y, plane.CurrentState.Position.Z); return plane; }
public Game() { _gameComponents = new List<GameComponent>(); _timer = new Timer(); _renderer = new Renderer(); Input = new Input(this, _renderer.Form.Handle); Register(Input); _world = new World(this, _renderer); Register(_world); _playerPlane = AirplaneFactory.Create(_world, this, _renderer, true); Register(_playerPlane); for (int i = 0; i < 5; i++) Register(AirplaneFactory.Create(_world, this, _renderer, false, _playerPlane)); Camera camera = new Camera(this, _playerPlane); Register(camera); _renderer.Camera = camera; Register(new MonitoringHeader(this, _renderer)); Register(new FlightRecorder(this, _timer, _playerPlane)); }
public AirplaneOverlay(Game game, Renderer renderer, Airplane airplane, Airplane playerAirplane) : base(game, renderer, airplane.UpdateOrder+1, false, true) { _airplane = airplane; _playerAirplane = playerAirplane; _shader = Renderer.FontShader; _overlay = new Bitmap(Renderer.DirectX.Device, Renderer.TextureManager.Create("Circle.png").TextureResource, Renderer.ScreenSize, new Vector2I(100, 100)) { Position = new Vector2I(0,0), Size = new Vector2I(40, 40) }; _color = new Vector4(0.2f, 0, 0, 0.4f); _distanceText = Renderer.TextManager.Create("Courrier", 14, 8, _color); _distanceText.Position = new Vector2I(0,0); _nameText = Renderer.TextManager.Create("Courrier", 14, 20, _color); _nameText.Position = new Vector2I(0,0); _nameText.Content = airplane.Name; _modelNameText = Renderer.TextManager.Create("Courrier", 14, 20, _color); _modelNameText.Position = new Vector2I(0, 0); _modelNameText.Content = airplane.ModelName; }
public AirplaneOverlay(Game game, Renderer renderer, Airplane airplane, Airplane playerAirplane) : base(game, renderer, airplane.UpdateOrder + 1, false, true) { _airplane = airplane; _playerAirplane = playerAirplane; _shader = Renderer.FontShader; _overlay = new Bitmap(Renderer.DirectX.Device, Renderer.TextureManager.Create("Circle.png").TextureResource, Renderer.ScreenSize, new Vector2I(100, 100)) { Position = new Vector2I(0, 0), Size = new Vector2I(40, 40) }; _color = new Vector4(0.2f, 0, 0, 0.4f); _distanceText = Renderer.TextManager.Create("Courrier", 14, 8, _color); _distanceText.Position = new Vector2I(0, 0); _nameText = Renderer.TextManager.Create("Courrier", 14, 20, _color); _nameText.Position = new Vector2I(0, 0); _nameText.Content = airplane.Name; _modelNameText = Renderer.TextManager.Create("Courrier", 14, 20, _color); _modelNameText.Position = new Vector2I(0, 0); _modelNameText.Content = airplane.ModelName; }
public Game() { _gameComponents = new List <GameComponent>(); _timer = new Timer(); _renderer = new Renderer(); Input = new Input(this, _renderer.Form.Handle); Register(Input); _world = new World(this, _renderer); Register(_world); _playerPlane = AirplaneFactory.Create(_world, this, _renderer, true); Register(_playerPlane); for (int i = 0; i < 5; i++) { Register(AirplaneFactory.Create(_world, this, _renderer, false, _playerPlane)); } Camera camera = new Camera(this, _playerPlane); Register(camera); _renderer.Camera = camera; Register(new MonitoringHeader(this, _renderer)); Register(new FlightRecorder(this, _timer, _playerPlane)); }
public static Airplane Create(World world, Game game, Renderer renderer, bool isPlayer = false, Airplane playerPlane = null) { if (random == null) { random = new Random(); } State state; if (isPlayer) { state = new State(510, 200); } else { state = new State(200 + random.Next(-1000, 2000), random.Next(-1500, 1500), 500 + random.Next(0, 1000), 200 + random.Next(0, 100), random.Next(-15, 15)); } Airplane plane = new Airplane(world, state, game, renderer, isPlayer, playerPlane, "F-14", "Plane " + i++); plane.PhysicalModel.Tanks.Add(new Tank(100, 500)); plane.PhysicalModel.Tanks.Add(new Tank(100, 500)); plane.PhysicalModel.Thrusters.Add(new Thruster()); plane.CurrentState.Position = new Vector3D(plane.CurrentState.Position.X - 2500, plane.CurrentState.Position.Y, plane.CurrentState.Position.Z); return(plane); }
public Airplane(World world, State state, Game game, Renderer renderer, bool isPlayer, Airplane playerPlane, String name, String modelName) : base(game, renderer, isPlayer ? -1000 : 0) { IsPlayer = isPlayer; World = world; CurrentState = state; Name = name; ModelName = modelName; if (isPlayer) { Commands = new PlayerAirplaneCommands(game.Input); } else { Commands = new ComputerAirplaneCommands(); } PhysicalModel = new AirplanePhysicalModel(this, Commands); Model = new ObjModel(renderer.DirectX.Device, "Airplane.obj", Renderer.TextureManager.Create("Metal.png")); if (!isPlayer && ConfigurationManager.Config.DisplayOverlay) { game.Register(new AirplaneOverlay(game, renderer, this, playerPlane)); } }