示例#1
0
文件: MazeReader.cs 项目: imann24/VR
 public static void AddPieceID(string pieceID, MazePiece type)
 {
     string[] idToAdd = {pieceID};
     if (type == MazePiece.Empty) EMPTY_ID.Concat(idToAdd);
     else if (type == MazePiece.Wall) WALL_ID.Concat(idToAdd);
     else if (type == MazePiece.Start) START_ID.Concat(idToAdd);
     else if (type == MazePiece.Finish) FINISH_ID.Concat(idToAdd);
     else if (type == MazePiece.DestroyableWall) DESTROYABLE_WALL_ID.Concat(idToAdd);
 }
示例#2
0
 public void MovePointers(MazePiece mazePiece, Vector3 worldPosition, Position mazePosition)
 {
     VisualPointer.Pointers [PointerType.Cursor].GoToGameObject (worldPosition, mazePiece);
     if (inputEnabled) {
         if (mazePiece != MazePiece.Wall) {
             VisualPointer.Pointers[PointerType.Mover].GoToGameObject(mazePosition, mazePiece);
         }
     }
 }
示例#3
0
    public void GoToGameObject(Vector3 gameObjectPosition, MazePiece type)
    {
        stopMovement();

        gameObjectPosition.y += yOffset;

        currentMoveCoroutine = LerpToPosition (gameObjectPosition);
        StartCoroutine (currentMoveCoroutine);
    }
 private static MazePiece GetOpposite(this MazePiece mazePiece)
 {
     return(mazePiece switch
     {
         MazePiece.North => MazePiece.South,
         MazePiece.East => MazePiece.West,
         MazePiece.South => MazePiece.North,
         MazePiece.West => MazePiece.East,
         _ => throw new ArgumentOutOfRangeException(nameof(mazePiece), mazePiece, null)
     });
示例#5
0
文件: Maze.cs 项目: imann24/VR
    public MazePiece[] MazePiecesFromPositions(Position[] positions)
    {
        MazePiece[] mazePieces = new MazePiece[positions.Length];

        for (int i = 0; i < positions.Length; i++) {
            mazePieces[i] = MazePieceFromPosition(positions[i]);
        }

        return mazePieces;
    }
示例#6
0
文件: Maze.cs 项目: imann24/VR
 public void ModifyPiece(int x, int y, MazePiece newType)
 {
     if (pieces == null ||
         x >= pieces.Length ||
         y >= pieces[x].Length) {
         Debug.LogError("Not a valid maze peice at " + x + ", " + y);
         return;
     } else {
         pieces[x][y] = newType;
     }
 }
示例#7
0
文件: MazeReader.cs 项目: imann24/VR
    public static Maze ParseMaze(string [][] pieceIDs)
    {
        MazePiece[][] mazePieces = new MazePiece[pieceIDs.GetLength(0)][];

        for (int x = 0; x < pieceIDs.Length; x++) {
            mazePieces[x] = new MazePiece[pieceIDs[x].Length];
            for (int y = 0; y < pieceIDs[x].Length; y++) {
                mazePieces[x][y] = ParsePiece(pieceIDs[x][y]);
            }
        }

        return new Maze(mazePieces);
    }
示例#8
0
    public void GoToGameObject(Position mazePiecePosition, MazePiece type)
    {
        if (currentPosition == null) {
            currentPosition = MazePositioner.GetClosestMazePosition(transform.position);
        }

        stopMovementCoroutine();

        StartCoroutine(
            currentMoveCoroutine = TraverseMazePositions(
            MazePositioner.WorldPathFromPosition(currentPosition,
                                             mazePiecePosition,
                                             MazeController.Instance.GetCurrentMaze())));
    }
示例#9
0
    void CreateMaze()
    {
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                maze [i, j]        = new MazePiece();
                maze[i, j].created = false;
                maze[i, j].right   = true;
                maze[i, j].bottom  = true;
            }
        }
        generateRecur(width / 2, height / 2);

        generateWalls();
    }
示例#10
0
 private static bool isWall(MazePiece pieceType)
 {
     return pieceType == MazePiece.Wall ||
         pieceType == MazePiece.DestroyableWall;
 }
示例#11
0
文件: Maze.cs 项目: imann24/VR
 // Overloaded method for the position
 public void ModifyPiece(Position position, MazePiece newType)
 {
     ModifyPiece(position.GetX(),
                 position.GetY(),
                 newType);
 }
示例#12
0
文件: Maze.cs 项目: imann24/VR
 public Maze(MazePiece[][] pieces)
 {
     this.pieces = pieces;
 }
示例#13
0
    private void destroyWall()
    {
        //TODO: Change from destroying the object outright to playing the destroy animation
        StartCoroutine(destroyWallAnimation(transform.GetChild(0)));

        Util.ToggleHalo(gameObject, false);

        callDetroyWallEvent();

        Type = MazePiece.Empty;
        MazeController.Instance.GetCurrentMaze().ModifyPiece(mazePosition,
                                                             MazePiece.Empty);
    }