Elin Modding Docs Doc
Loading...
Searching...
No Matches
MapGenRegion.cs
1using System;
2using CreativeSpore.SuperTilemapEditor;
3using UnityEngine;
4
5// Token: 0x02000672 RID: 1650
6public class MapGenRegion : BaseMapGen
7{
8 // Token: 0x17000D1B RID: 3355
9 // (get) Token: 0x06002E45 RID: 11845 RVA: 0x0010524F File Offset: 0x0010344F
10 public static MapGenRegion Instance
11 {
12 get
13 {
14 MapGenRegion result;
15 if ((result = MapGenRegion._Instance) == null)
16 {
17 result = (MapGenRegion._Instance = new MapGenRegion());
18 }
19 return result;
20 }
21 }
22
23 // Token: 0x06002E46 RID: 11846 RVA: 0x00105268 File Offset: 0x00103468
24 protected override bool OnGenerateTerrain()
25 {
26 EClass.scene.elomapActor.Initialize(this.zone.Region.elomap);
27 EloMap elomap = EClass.scene.elomapActor.elomap;
28 base.SetSize(Mathf.Max(elomap.w, elomap.h), 10);
29 this.map.CreateNew(this.Size, true);
30 for (int i = 0; i < elomap.h; i++)
31 {
32 for (int j = 0; j < elomap.w; j++)
33 {
34 elomap.cells[j, i];
35 int gridX = elomap.minX + j;
36 int gridY = elomap.minY + i;
37 this.map.cells[j, i].isSeen = true;
38 base.SetFloor(j, i, 66, 43, 0);
39 foreach (STETilemap stetilemap in elomap.group.Tilemaps)
40 {
41 if (!(stetilemap == elomap.fogmap) && !(stetilemap == elomap.cloudmap))
42 {
43 int tileIdFromTileData = Tileset.GetTileIdFromTileData(stetilemap.GetTileData(gridX, gridY));
44 SourceGlobalTile.Row row = EClass.sources.globalTiles.tileAlias.TryGetValue(tileIdFromTileData, null);
45 if (row != null)
46 {
47 this.map.cells[j, i].impassable = (row.attribs[0] == 0);
48 if (row.floor != 0)
49 {
50 base.SetFloor(j, i, EClass.sources.floors.rows[row.floor].DefaultMaterial.id, row.floor, 0);
51 }
52 }
53 }
54 }
55 if (Tileset.GetTileIdFromTileData(elomap.cloudmap.GetTileData(gridX, gridY)) < 1000)
56 {
57 this.map.cells[j, i].impassable = true;
58 }
59 }
60 }
61 this.map.poiMap.Reset();
62 this.map.SetZone(this.zone);
63 this.map.config.idSceneProfile = "region";
64 this.map.RefreshAllTiles();
65 return true;
66 }
67
68 // Token: 0x04001A43 RID: 6723
69 private static MapGenRegion _Instance;
70}