43 lines
1.6 KiB
C#
Raw Normal View History

2021-12-14 22:53:53 +00:00
using QSB.Player;
using UnityEngine;
2021-11-25 11:27:58 +00:00
using UnityEngine.Rendering;
namespace QSB.Tools.SignalscopeTool
{
2021-11-09 19:39:56 +00:00
internal static class SignalscopeCreator
{
2021-11-20 19:49:50 +00:00
private static readonly Vector3 SignalscopeScale = new(1.5f, 1.5f, 1.5f);
2021-12-14 22:53:53 +00:00
internal static void CreateSignalscope(PlayerInfo player)
{
var signalscopeRoot = Object.Instantiate(GameObject.Find("Signalscope"));
signalscopeRoot.name = "REMOTE_Signalscope";
signalscopeRoot.SetActive(false);
2021-11-25 11:27:58 +00:00
var Props_HEA_Signalscope = signalscopeRoot.transform.Find("Props_HEA_Signalscope");
Object.Destroy(signalscopeRoot.GetComponent<SignalscopePromptController>());
2021-11-25 11:27:58 +00:00
Object.Destroy(Props_HEA_Signalscope.Find("Props_HEA_Signalscope_Prepass").gameObject);
var oldSignalscope = signalscopeRoot.GetComponent<Signalscope>();
var tool = signalscopeRoot.AddComponent<QSBTool>();
tool.MoveSpring = oldSignalscope._moveSpring;
tool.StowTransform = PlayerToolsManager.StowTransform;
tool.HoldTransform = PlayerToolsManager.HoldTransform;
tool.ArrivalDegrees = 5f;
tool.Type = ToolType.Signalscope;
2021-11-25 11:27:58 +00:00
tool.ToolGameObject = Props_HEA_Signalscope.gameObject;
2021-12-14 22:53:53 +00:00
tool.Player = player;
oldSignalscope.enabled = false;
2021-11-25 11:27:58 +00:00
Props_HEA_Signalscope.GetComponent<MeshRenderer>().material = PlayerToolsManager.Props_HEA_PlayerTool_mat;
Props_HEA_Signalscope.GetComponent<MeshRenderer>().shadowCastingMode = ShadowCastingMode.On;
2021-12-14 22:53:53 +00:00
signalscopeRoot.transform.parent = player.CameraBody.transform;
signalscopeRoot.transform.localPosition = Vector3.zero;
signalscopeRoot.transform.localScale = SignalscopeScale;
signalscopeRoot.SetActive(true);
}
}
}