public AiPlayer(WarZGame game, Camera camera, Tank tank, Terrain terrain, int id) : base(game, camera, tank, terrain) { WZGame = game; Behaviors = new List<AiPlayerBehavior>(MAX_BEHAVIORS); MaxSpeed = 5f; this.id = id; }
public Player(WarZGame game, Camera camera, Tank tank, Terrain terrain) : base(game) { WZGame = game; _mesh = tank; _terrain = terrain; ChangeCamera(camera); _canonManager = new CanonManager(game); _soundFire = WZGame.Content.Load<SoundEffect>("Sounds/tank - shoot"); _soundTankGo = WZGame.Content.Load<SoundEffect>("Sounds/tank - go"); _soundTankGoInstance = _soundTankGo.CreateInstance(); _soundTankGoInstance.IsLooped = true; // _camera.HorizontalOffset = 4f; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Window.Title = "WarZ v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Prepare3DRenderer.Initialize(this); Song mainTheme = Content.Load<Song>(@"Music/main1"); MediaPlayer.Play(mainTheme); MediaPlayer.Volume *= 0.7f; _fpsCamera = new FPSCamera(this, new Vector3(0, 10, 3), Vector3.Zero, Vector3.Up); _topViewCamera = new TopViewCamera(this, new Vector3(0, 10, 0), Vector3.Zero, Vector3.Forward); // _chaseCamera = new ChaseCamera(this, new Vector3(0, 10, 3), Vector3.Zero, Vector3.Up); SimpleCamera simpleCam = new SimpleCamera(this, Vector3.Zero, Vector3.Forward, Vector3.Up); _aiCamera = new SimpleCamera(this, Vector3.Backward, Vector3.Zero, Vector3.Up); GodViewCamera godView = new GodViewCamera(this, Vector3.Up * 50, Vector3.Forward * 62.5f + Vector3.Right * 62.5f, Vector3.Up); _cameras = new Camera[3]; _cameras[0] = _fpsCamera; _cameras[1] = _topViewCamera; _cameras[2] = godView; cameraNumber = 0; _activeCamera = _fpsCamera; _3DAxis = new Axis(this, _activeCamera); _GUI = new GUIManager(this); _GUI.CrossairVisible = true; Terrain = new Terrain(this, _activeCamera); _skybox = new Skybox(this, _activeCamera); Tank tank = new Tank(this, Content.Load<Model>(@"Models\Tank\DXTank")); Player1 = new Player(this, _activeCamera, tank, Terrain); _aiPlayerManager = new AiPlayerManager(this, tank); _collisionSystem = new CollisionSystem(this, _player1, _aiPlayerManager); _particlesManager = new ParticlesManager(this); Components.Add(_skybox); //Components.Add(_activeCamera); Components.Add(Player1); Components.Add(_3DAxis); Components.Add(Terrain); Components.Add(_aiPlayerManager); Components.Add(_collisionSystem); Components.Add(_particlesManager); Components.Add(_GUI); _aiPlayerManager.AddBot(_aiCamera, Vector3.Backward * 10 + Vector3.Right * 20); _aiPlayerManager.AddBot(_aiCamera, Vector3.Backward * 10 + Vector3.Right * 10); _aiPlayerManager.AddBot(_aiCamera, Vector3.Backward * 10 + Vector3.Right * 10); _aiPlayerManager.AddBot(_aiCamera, Vector3.Backward * 10 + Vector3.Right * 10); _aiPlayerManager.AddBot(_aiCamera, Vector3.Backward * 10 + Vector3.Right * 10); base.Initialize(); }
public void ApplySurfaceFollow(Terrain terrain) { _position.Y = _offset.Y + terrain.GetPositionHeight(_position.X, _position.Z); }