예제 #1
0
 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));
 }
예제 #2
0
        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;
        }
예제 #3
0
 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));
 }