Exemplo n.º 1
0
        /// <summary>
        /// Creates a new player.
        /// </summary>
        /// <param name="position">The player's initial position.</param>
        private Player( Vector3 position )
        {
            Position = position;
            Size = new Vector3( 0.8f, 1.6f, 0.8f );
            _camera = new PlayerCamera( this );
            _isFirstUpdate = true;

            HandleInput = true;
            LookVelocity = 0.0025f;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Disables no-clip.
        /// </summary>
        private void DisableNoClip()
        {
            var fc = _camera as FreeCamera;
            _position = fc.Position;
            _position.Y -= PlayerSizeY / 3.0f;

            _camera = PlayerCamera.FromFreeCamera( fc, this );
            _camera.Update( null );

            _isNoClipEnabled = false;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Enables no-clip.
        /// </summary>
        private void EnableNoClip()
        {
            var pc = _camera as PlayerCamera;
            _camera = FreeCamera.FromPlayerCamera( pc );

            _isNoClipEnabled = true;
            ResetPhysics();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Draws all of the chunks, assuming that an effect is currently active.
 /// </summary>
 /// <param name="camera">The camera to use for visibility testing.</param>
 public void DrawChunks( Camera camera )
 {
     lock ( _chunks )
     {
         // render each chunk that the camera can see
         foreach ( var chunk in _chunks.Values )
         {
             if ( Game.Instance.Settings.CullFrustum  )
             {
                 if ( camera.CanSee( chunk.Bounds ) )
                 {
                     chunk.Draw();
                 }
             }
             else
             {
                 chunk.Draw();
             }
         }
     }
 }