-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColorCameras.cs
61 lines (54 loc) · 1.84 KB
/
ColorCameras.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using OWML.Common;
using OWML.ModHelper;
using System.IO;
using UnityEngine;
namespace ColorCameras {
public class ColorCameras : ModBehaviour
{
private void Awake()
{
// You won't be able to access OWML's mod helper in Awake.
// So you probably don't want to do anything here.
// Use Start() instead.
}
private void Start()
{
LoadManager.OnCompleteSceneLoad += (scene, loadScene) =>
{
ModHelper.Events.Unity.FireOnNextUpdate(() => {
var cameras = Resources.FindObjectsOfTypeAll<OWCamera>();
for (int i = 0; i < cameras.Length; i++)
{
if (cameras[i].postProcessingSettings != null) cameras[i].postProcessingSettings.userLutEnabled = false;
}
if (loadScene == OWScene.SolarSystem || loadScene == OWScene.EyeOfTheUniverse)
{
if (loadScene != OWScene.EyeOfTheUniverse)
{
var landingCamera = Locator.GetShipTransform().Find("Module_Cockpit/Systems_Cockpit/LandingCamera");
var lut = GetTexture("landingcamlut.png");
lut.anisoLevel = 0;
landingCamera.GetComponent<LandingCamera>()._landingCameraLUT = lut;
landingCamera.GetComponent<LandingCamera>().Awake();
}
ModHelper.Events.Unity.RunWhen(PlayerState.IsWearingSuit, () =>
{
var hud = Locator.GetPlayerTransform().Find("PlayerCamera/Helmet/HUDController").GetComponent<HUDCanvas>();
var scoutMat = hud._hudProbeLauncherUI._material;
scoutMat.SetColor("_Color", new Color(1f, 0.75f, 0.75f, 1f));
});
}
});
};
}
public Texture2D GetTexture(string filename)
{
string path = ModHelper.Manifest.ModFolderPath + filename;
ModHelper.Console.WriteLine("Loading texture from " + path);
byte[] data = File.ReadAllBytes(path);
Texture2D tex = new Texture2D(2, 2, TextureFormat.RGB24, false, true);
tex.LoadImage(data);
return tex;
}
}
}