Definition at line 6 of file MapPiece.cs.
◆ Type
Enumerator |
---|
Any | |
Deco | |
Treasure | |
Trap | |
Concert | |
Farm | |
Definition at line 15 of file MapPiece.cs.
◆ GetMap()
Definition at line 49 of file MapPiece.cs.
50 {
52 Item item =
items.RandomItemWeighted((Item a) => (a.chance != 0f || !(type.ToString() == a.id)) ? (a.chance * (
float)((type ==
Type.Any || type.ToString() == a.id) ? 1 : 0)) : 1f);
53 if (
item.paths.Count == 0)
54 {
56 return null;
57 }
58 string[] array = (tag.IsEmpty() ? null : tag.Split(','));
59 List<MapPath> list = new List<MapPath>();
60 foreach (MapPath path2
in item.paths)
61 {
62 if (path2.tag.IsEmpty() || (array != null && array.Contains(tag)))
63 {
64 list.Add(path2);
65 }
66 }
67 if (list.Count == 0)
68 {
69 return null;
70 }
71 string path = list.RandomItem().path;
72 Debug.Log(
"Loading PartialMap:" + path);
74 if (partialMap == null)
75 {
78 }
80 {
82 }
83 partialMap.procedural = true;
84 partialMap.ruinChance = ruin;
85 return partialMap;
86 }
static Dictionary< string, PartialMap > CacheMap
static PartialMap Load(string path=null)
References PartialMap.allowRotate, CacheMap, MapPiece.Item.chance, Debug, MapPiece.Item.id, Init(), item, items, PartialMap.Load(), EScriptable.rnd(), and MapPiece.MapPath.tag.
Referenced by GenBounds.TryAddMapPiece().
◆ Init()
Definition at line 88 of file MapPiece.cs.
89 {
91 {
92 return;
93 }
95 {
98 foreach (string text in files)
99 {
100 if (text.EndsWith("mp"))
101 {
102 DirectoryInfo directory = new FileInfo(text).Directory;
103 string tag = ((directory.Parent.Name !=
item.id) ?
"" : directory.Name);
104 item.paths.Add(
new MapPath
105 {
106 path = text,
107 tag = tag
108 });
109 }
110 }
111 }
113 }
static string MapPieceSave
References initialized, item, items, and CorePath.MapPieceSave.
Referenced by GetMap().
◆ Reset()
◆ _Instance
◆ CacheMap
◆ initialized
bool MapPiece.initialized |
|
static |
◆ items
List<Item> MapPiece.items |
◆ Instance
◆ IsEditor
The documentation for this class was generated from the following file: