Esempio n. 1
0
 bool SetLeftOrRightVertices(LevelPiece piece)
 {
     // Check if we need to draw the left, right, or neither edge:
     if (_player.Position.X > piece.RightEdge)
     {
         /*
         left of us:
         FR
         |    R  
         |    |   *
         |    L  
         FL      
         */
         _leftRightVertices[VertexPosition.NearLeft] = new VertexPositionColor(new Vector3(piece.RightEdge, piece.BottomEdge, 0), VisibilityView.ShadowColor);
         _leftRightVertices[VertexPosition.NearRight] = new VertexPositionColor(new Vector3(piece.RightEdge, piece.TopEdge, 0), VisibilityView.ShadowColor);
         return true;
     }
     else if (_player.Position.X < piece.LeftEdge)
     {
         /*
         right of us:
                 FL
             NL  |
          *  |   |
             NR  |
                 FR
         */
         _leftRightVertices[VertexPosition.NearLeft] = new VertexPositionColor(new Vector3(piece.LeftEdge, piece.TopEdge, 0), VisibilityView.ShadowColor);
         _leftRightVertices[VertexPosition.NearRight] = new VertexPositionColor(new Vector3(piece.LeftEdge, piece.BottomEdge, 0), VisibilityView.ShadowColor);
         return true;
     }
     return false;
 }
Esempio n. 2
0
 bool SetBottomOrTopEdgeVertices(LevelPiece piece)
 {
     // Check if we need to draw the top, bottom, or neither edge:
     if (_player.Position.Y > piece.BottomEdge)
     {
         /*
         above us:
         FL-----FR
          
          NL---NR
             * 
         */
         _topBotVertices[VertexPosition.NearLeft] = new VertexPositionColor(new Vector3(piece.LeftEdge, piece.BottomEdge, 0), VisibilityView.ShadowColor);
         _topBotVertices[VertexPosition.NearRight] = new VertexPositionColor(new Vector3(piece.RightEdge, piece.BottomEdge, 0), VisibilityView.ShadowColor);
         return true;
     }
     else if (_player.Position.Y < piece.TopEdge)
     {
         /*
         below us:
            * 
         NR---NL
             
        FR-----FL
         */
         _topBotVertices[VertexPosition.NearLeft] = new VertexPositionColor(new Vector3(piece.RightEdge, piece.TopEdge, 0), VisibilityView.ShadowColor);
         _topBotVertices[VertexPosition.NearRight] = new VertexPositionColor(new Vector3(piece.LeftEdge, piece.TopEdge, 0), VisibilityView.ShadowColor);
         return true;
     }
     return false;
 }
Esempio n. 3
0
 public DumbLevelLoader(LevelPiece.Factory levelPieceFactory)
 {
     _levelPieceFactory = levelPieceFactory;
 }