コード例 #1
0
ファイル: Player.cs プロジェクト: TheCodeInside/kyoob
        /// <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;
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: TheCodeInside/kyoob
        /// <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;
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: TheCodeInside/kyoob
        /// <summary>
        /// Enables no-clip.
        /// </summary>
        private void EnableNoClip()
        {
            var pc = _camera as PlayerCamera;
            _camera = FreeCamera.FromPlayerCamera( pc );

            _isNoClipEnabled = true;
            ResetPhysics();
        }
コード例 #4
0
ファイル: WorldManager.cs プロジェクト: TheCodeInside/kyoob
 /// <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();
             }
         }
     }
 }