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); }
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); } } }
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) });
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; }
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; } }
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); }
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()))); }
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(); }
private static bool isWall(MazePiece pieceType) { return pieceType == MazePiece.Wall || pieceType == MazePiece.DestroyableWall; }
// Overloaded method for the position public void ModifyPiece(Position position, MazePiece newType) { ModifyPiece(position.GetX(), position.GetY(), newType); }
public Maze(MazePiece[][] pieces) { this.pieces = pieces; }
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); }