Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 KB | None | 0 0
  1. using System.Collections;
  2. using System; // So the script can use the serialization commands
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5.  
  6. public class MapManager
  7. {
  8.     public static Tile[,] map; // the 2-dimensional map with the information for all the tiles
  9. }
  10.  
  11. [Serializable] // Makes the class serializable so it can be saved out to a file
  12. public class Tile
  13. { // Holds all the information for each tile on the map
  14.     public int xPosition; // the position on the x axis
  15.     public int yPosition; // the position on the y axis
  16.     [NonSerialized]
  17.     public GameObject baseObject; // the map game object attached to that position: a floor, a wall, etc.
  18.     public string type; // The type of the tile, if it is wall, floor, etc
  19. }
  20.  
  21. [Serializable]
  22. public class Wall
  23. { // A class for saving the wall information, for the dungeon generation algorithm
  24.     public List<Vector2Int> positions;
  25.     public string direction;
  26.     public int length;
  27.     public bool hasFeature = false;
  28.     public Feature parent;
  29. }
  30.  
  31. [Serializable]
  32. public class Feature
  33. { // A class for saving the feature (corridor or room) information, for the dungeon generation algorithm
  34.     public List<Vector2Int> positions;
  35.     public Wall[] walls;
  36.     public string type;
  37.     public int width;
  38.     public int height;
  39.     public int id;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement