quantum-space-buddies/QSB/Tools/PlayerToolsManager.cs

116 lines
5.3 KiB
C#
Raw Normal View History

2021-11-09 19:39:56 +00:00
using QSB.Tools.FlashlightTool;
2021-07-26 22:55:09 +01:00
using QSB.Tools.ProbeLauncherTool;
using QSB.Tools.SignalscopeTool;
using QSB.Tools.TranslatorTool;
2020-08-23 13:12:18 +01:00
using System.Linq;
using UnityEngine;
namespace QSB.Tools
{
2020-12-02 21:23:01 +00:00
public class PlayerToolsManager
{
public static Transform StowTransform;
public static Transform HoldTransform;
2020-12-02 21:23:01 +00:00
public static Material Props_HEA_PlayerTool_mat;
public static Material Props_HEA_Lightbulb_mat;
public static Material Props_HEA_Lightbulb_OFF_mat;
2020-12-02 21:23:01 +00:00
2021-07-07 19:45:14 +01:00
public static void Init(Transform playerCamera)
2020-12-02 21:23:01 +00:00
{
2021-07-07 19:45:14 +01:00
CreateStowTransforms(playerCamera);
2020-12-02 21:23:01 +00:00
2021-07-21 10:19:57 +01:00
Props_HEA_PlayerTool_mat = GameObject.Find("Props_HEA_ProbeLauncher_ProbeCamera/ProbeLauncherChassis").GetComponent<MeshRenderer>().materials[0];
Props_HEA_Lightbulb_OFF_mat = GameObject.Find("Props_HEA_Probe_Prelaunch").GetComponent<MeshRenderer>().materials[1];
2020-12-02 21:23:01 +00:00
if (QSBSceneManager.CurrentScene == OWScene.SolarSystem)
{
2021-07-21 10:19:57 +01:00
Props_HEA_Lightbulb_mat = GameObject.Find("Props_HEA_Lantern (10)/Lantern_Lamp").GetComponent<MeshRenderer>().materials[0];
Props_HEA_Lightbulb_OFF_mat = GameObject.Find("NomaiResearchExhibit/Props_HEA_Probe_STATIC").GetComponent<MeshRenderer>().materials[1];
2020-12-02 21:23:01 +00:00
}
else if (QSBSceneManager.CurrentScene == OWScene.EyeOfTheUniverse)
{
2021-07-21 10:19:57 +01:00
Props_HEA_Lightbulb_mat = GameObject.Find("lantern_lamp").GetComponent<MeshRenderer>().materials[0];
2021-08-22 16:40:50 +01:00
// BUG : uhhhhh fuckin' uhhhhhhhh (find a material)
2021-07-21 10:19:57 +01:00
Props_HEA_Lightbulb_OFF_mat = null;
2020-12-02 21:23:01 +00:00
}
FlashlightCreator.CreateFlashlight(playerCamera);
SignalscopeCreator.CreateSignalscope(playerCamera);
ProbeLauncherCreator.CreateProbeLauncher(playerCamera);
TranslatorCreator.CreateTranslator(playerCamera);
2020-12-02 21:23:01 +00:00
}
private static void CreateStowTransforms(Transform cameraBody)
{
2021-07-19 14:58:28 +01:00
var stow = new GameObject("REMOTE_ToolStowTransform");
StowTransform = stow.transform;
2020-12-02 21:23:01 +00:00
stow.transform.parent = cameraBody;
stow.transform.localPosition = Vector3.zero;
stow.transform.localRotation = Quaternion.Euler(45f, 0f, 0f);
2021-07-19 14:58:28 +01:00
var hold = new GameObject("REMOTE_ToolHoldTransform");
HoldTransform = hold.transform;
2020-12-02 21:23:01 +00:00
hold.transform.parent = cameraBody;
hold.transform.localPosition = Vector3.zero;
hold.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
2021-02-26 10:23:08 +00:00
2021-07-19 14:58:28 +01:00
var item = new GameObject("REMOTE_ItemSocket");
2021-02-26 10:23:08 +00:00
item.transform.parent = cameraBody;
item.transform.localPosition = new Vector3(0.125f, -0.12f, 0.2f);
item.transform.localRotation = Quaternion.Euler(0, 0, 15);
item.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f);
2021-07-19 14:58:28 +01:00
var scroll = new GameObject("REMOTE_ScrollSocket");
2021-02-26 10:23:08 +00:00
scroll.transform.parent = cameraBody;
scroll.transform.localPosition = new Vector3(0.148f, -0.0522f, 0.2465f);
scroll.transform.localRotation = Quaternion.Euler(236.054f, 56.46799f, -152.472f);
scroll.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f);
2021-02-27 09:33:33 +00:00
2021-07-19 14:58:28 +01:00
var sharedStone = new GameObject("REMOTE_SharedStoneSocket");
2021-02-27 09:33:33 +00:00
sharedStone.transform.parent = cameraBody;
sharedStone.transform.localPosition = new Vector3(0.1375f, -0.119f, 0.2236f);
sharedStone.transform.localRotation = Quaternion.Euler(-23.053f, -0.263f, 6.704f);
sharedStone.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f);
2021-07-19 14:58:28 +01:00
var warpCore = new GameObject("REMOTE_WarpCoreSocket");
2021-02-27 09:33:33 +00:00
warpCore.transform.parent = cameraBody;
warpCore.transform.localPosition = new Vector3(0.161f, -0.107f, 0.223f);
warpCore.transform.localRotation = Quaternion.Euler(179.949f, 82.59f, 163.697f);
warpCore.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f);
2021-07-19 14:58:28 +01:00
var vesselCore = new GameObject("REMOTE_VesselCoreSocket");
2021-02-27 09:33:33 +00:00
vesselCore.transform.parent = cameraBody;
vesselCore.transform.localPosition = new Vector3(0.177f, -0.106f, 0.2f);
vesselCore.transform.localRotation = Quaternion.Euler(3.142f, 14.827f, 12.094f);
vesselCore.transform.localScale = new Vector3(0.27f, 0.27f, 0.27f);
2021-11-01 15:49:00 +00:00
var simpleLantern = new GameObject("REMOTE_SimpleLanternSocket");
simpleLantern.transform.parent = cameraBody;
simpleLantern.transform.localPosition = new Vector3(0.242997f, -0.18f, 0.2620007f);
simpleLantern.transform.localRotation = Quaternion.Euler(0f, 33f, 0f);
simpleLantern.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f);
var dreamLantern = new GameObject("REMOTE_DreamLanternSocket");
dreamLantern.transform.parent = cameraBody;
dreamLantern.transform.localPosition = new Vector3(0.243f, -0.207f, 0.262f);
dreamLantern.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
dreamLantern.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f);
var slideReel = new GameObject("REMOTE_SlideReelSocket");
slideReel.transform.parent = cameraBody;
slideReel.transform.localPosition = new Vector3(0.1353f, -0.0878f, 0.2878f);
slideReel.transform.localRotation = Quaternion.Euler(-145.532f, 6.589996f, -94.54901f);
slideReel.transform.localScale = new Vector3(0.3300001f, 0.33f, 0.3299999f);
var visionTorch = new GameObject("REMOTE_VisionTorchSocket");
visionTorch.transform.parent = cameraBody;
visionTorch.transform.localPosition = new Vector3(0.21f, -0.32f, 0.33f);
visionTorch.transform.localRotation = Quaternion.Euler(-4.5f, 0.03f, 9f);
visionTorch.transform.localScale = new Vector3(0.33f, 0.33f, 0.33f);
2020-12-02 21:23:01 +00:00
}
internal static MeshRenderer GetRenderer(GameObject root, string gameObjectName) =>
2020-12-14 21:20:53 +00:00
root.GetComponentsInChildren<MeshRenderer>(true).First(x => x.name == gameObjectName);
}
}