-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventSetup.cs
45 lines (39 loc) · 1.35 KB
/
EventSetup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using ChallengeChest.Patch;
using SoftReferenceableAssets;
namespace ChallengeChest;
public static class EventSetup
{
public const string PrefabName = "cc_EventPrefab";
public static GameObject Prefab;
public static SoftReference<GameObject> locationReference = new();
public static Location Location;
public static readonly Dictionary<Heightmap.Biome, Sprite> Icons = [];
public static float Range = 30;
public static void Init()
{
Debug("Initializing EventSetup...");
Prefab = RegisterPrefabs.Prefab(PrefabName);
Location = Prefab.GetComponent<Location>();
Range = Location?.GetMaxRadius() ?? 10f;
SetupIcons();
Debug("Done EventSetup init");
}
private static void SetupIcons()
{
AddIcon(Heightmap.Biome.Meadows);
AddIcon(Heightmap.Biome.Swamp);
AddIcon(Heightmap.Biome.Mountain);
AddIcon(Heightmap.Biome.BlackForest);
AddIcon(Heightmap.Biome.Plains);
AddIcon(Heightmap.Biome.AshLands);
AddIcon(Heightmap.Biome.DeepNorth);
AddIcon(Heightmap.Biome.Ocean);
AddIcon(Heightmap.Biome.Mistlands);
return;
void AddIcon(Heightmap.Biome biome)
{
var spriteName = $"cc_Icon{biome.ToString()}";
Icons.Add(biome, RegisterPrefabs.Sprite(spriteName));
}
}
}