forked from ButteryStancakes/Chameleon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.cs
More file actions
63 lines (49 loc) · 2.06 KB
/
Common.cs
File metadata and controls
63 lines (49 loc) · 2.06 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Chameleon.Info;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace Chameleon
{
internal class Common
{
internal static bool INSTALLED_ARTIFICE_BLIZZARD;
// * ----- REFERENCES ----- *
// string matching the name of the current interior ("Level1Flow", "Level2Flow", or "Level3Flow")
internal static string interior;
// see LevelCosmeticInfo.cs
internal static LevelCosmeticInfo currentLevelCosmeticInfo;
// ArtificeBlizzard compatibility
internal static GameObject artificeBlizzard;
internal static void GetReferences()
{
interior = StartOfRound.Instance.currentLevel.name != "CompanyBuildingLevel" ? RoundManager.Instance?.dungeonGenerator?.Generator?.DungeonFlow?.name : string.Empty;
VanillaLevelsInfo.predefinedLevels.TryGetValue(StartOfRound.Instance.currentLevel.name, out currentLevelCosmeticInfo);
if (StartOfRound.Instance.currentLevel.name == "ArtificeLevel" && INSTALLED_ARTIFICE_BLIZZARD)
{
artificeBlizzard = GameObject.Find("/Systems/Audio/BlizzardAmbience");
if (artificeBlizzard != null)
Plugin.Logger.LogInfo("Artifice Blizzard compatibility success");
}
}
// * ----- ASSETS ----- *
// solid black material
internal static Material black;
internal static void GetSharedAssets()
{
if (black != null)
return;
try
{
AssetBundle lightMats = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "chameleon"));
black = lightMats.LoadAsset<Material>("black");
lightMats.Unload(false);
}
catch
{
Plugin.Logger.LogError("Encountered some error loading assets from bundle \"chameleon\". Did you install the plugin correctly?");
}
}
}
}