public void CreateStart(TileEntity tile, Direction dir) { switch (dir) { case Direction.Left: tile.ChangeWall(Direction.Left, StartDoor, TypeWall.Start); break; case Direction.Right: tile.ChangeWall(Direction.Right, StartDoor, TypeWall.Start); break; case Direction.Up: tile.ChangeWall(Direction.Up, StartDoor, TypeWall.Start); break; case Direction.Down: tile.ChangeWall(Direction.Down, StartDoor, TypeWall.Start); break; } Transform start = GameMath.FindComponentInChildWithTag <Transform>(tile.gameObject, "Respawn"); OnSetStart?.Invoke(start); }
public void RemoveWall(TileEntity tile, Direction dir) { EntityWall wall = SelectEnter(); GameObject wallObj = (wall.Point == null) ? null: wall.Point.gameObject; switch (dir) { case Direction.Left: tile.ChangeWall(Direction.Left, wallObj, wall.Type); break; case Direction.Right: tile.ChangeWall(Direction.Right, wallObj, wall.Type); break; case Direction.Up: tile.ChangeWall(Direction.Up, wallObj, wall.Type); break; case Direction.Down: tile.ChangeWall(Direction.Down, wallObj, wall.Type); break; } }
public void CreateExit(TileEntity tile, Direction dir) { switch (dir) { case Direction.Left: tile.ChangeWall(Direction.Left, ExitDoor, TypeWall.Exit); break; case Direction.Right: tile.ChangeWall(Direction.Right, ExitDoor, TypeWall.Exit); break; case Direction.Up: tile.ChangeWall(Direction.Up, ExitDoor, TypeWall.Exit); break; case Direction.Down: tile.ChangeWall(Direction.Down, ExitDoor, TypeWall.Exit); break; } Transform exit = GameMath.FindComponentInChildWithTag <Transform>(tile.gameObject, "Finish"); OnSetExit?.Invoke(exit); }
// Function disables wall of your choosing, pass it the script attached to the desired cell // and an 'ID', where the ID = the wall. 1 = left, 2 = right, 3 = up, 4 = down. public void RemoveWall(TileEntity cScript, int wallID, bool isRandom = true) { if (wallID == 1) { cScript.ChangeWall(Direction.Left, SelectPassage(isRandom), TypeWall.Null); } else if (wallID == 2) { cScript.ChangeWall(Direction.Right, SelectPassage(isRandom), TypeWall.Null); } else if (wallID == 3) { cScript.ChangeWall(Direction.Up, SelectPassage(isRandom), TypeWall.Null); } else if (wallID == 4) { cScript.ChangeWall(Direction.Down, SelectPassage(isRandom), TypeWall.Null); } }