예제 #1
0
파일: Player.cs 프로젝트: vvolkgang/WarZ
        public override void Draw(GameTime gameTime)
        {
            UpdateTank(gameTime);
            _mesh.IsAi = false;
            _mesh.DrawModel(_camera);

            CanonManager.Draw(gameTime);

            base.Draw(gameTime);
        }
예제 #2
0
파일: Player.cs 프로젝트: vvolkgang/WarZ
        protected virtual void HandleInput(GameTime gameTime)
        {
            //movement
            _movement = Vector3.Zero;
            if (KeyboardHelper.IsKeyDown(Keys.W))
            {
                _movement.Z = -1;
            }
            else if (KeyboardHelper.IsKeyDown(Keys.S))
            {
                _movement.Z = 1;
            }

            //rotation
            _turnAmount = 0;
            if (KeyboardHelper.IsKeyDown(Keys.A))
            {
                _turnAmount += 1;
            }
            else if (KeyboardHelper.IsKeyDown(Keys.D))
            {
                _turnAmount += -1;
            }

            timeSpent += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (timeSpent > reloadingTime)
            {
                if (MouseHelper.IsLeftButtonPressed())
                {
                    CanonManager.Fire(_position + Vector3.Up * 1.7f, Vector3.Zero, _camera.Yaw, _camera.Pitch, gameTime.TotalGameTime);
                    _soundFire.Play();

                    timeSpent = 0f;
                }
            }

            if (Keyboard.GetState().IsKeyDown(Keys.LeftShift))
            {
                recenter = true;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.T))
            {
                _soundTankGoInstance.Play();
            }
        }
예제 #3
0
파일: Player.cs 프로젝트: vvolkgang/WarZ
        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;
        }
예제 #4
0
파일: Player.cs 프로젝트: vvolkgang/WarZ
        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;
        }
예제 #5
0
파일: Player.cs 프로젝트: vvolkgang/WarZ
 void UpdateCanonManager(GameTime gameTime)
 {
     CanonManager.Update(gameTime);
 }