void Awake() { if (LoadManager.GetCurrentScene() == OWScene.SolarSystem) { _shipWindshield = GameObject.Find("ShipLODTrigger_Cockpit").transform; } _signalscope = Camera.main.transform.Find("Signalscope").GetComponent <Signalscope>(); Hands.HoldObject(_signalscope.transform, Hands.RightHand, new Vector3(-0.047f, 0.053f, 0.143f), Quaternion.Euler(32.8f, 0, 0)); var signalScopeModel = _signalscope.transform.GetChild(0); // Tools have a special shader that draws them on top of everything // and screws with perspective. Changing to Standard shader so they look // like a normal 3D object. signalScopeModel.GetComponent <MeshRenderer>().material.shader = Shader.Find("Standard"); signalScopeModel.localPosition = Vector3.up * -0.1f; signalScopeModel.localRotation = Quaternion.identity; // This child seems to be only for some kind of shader effect. // Disabling it since it looks glitchy and doesn't seem necessary. signalScopeModel.GetChild(0).gameObject.SetActive(false); var signalScopeHolster = Instantiate(signalScopeModel).gameObject; signalScopeHolster.SetActive(true); var holster = signalScopeHolster.AddComponent <HolsterTool>(); holster.hand = Hands.RightHand; holster.position = new Vector3(0.3f, -0.55f, 0); holster.mode = ToolMode.SignalScope; holster.scale = 0.8f; holster.angle = Vector3.right * 90; holster.onUnequip = OnUnequip; var playerHUD = GameObject.Find("PlayerHUD").transform; _reticule = playerHUD.Find("HelmetOffUI/SignalscopeReticule"); // Attatch Signalscope UI to the Signalscope. _reticule.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace; _reticule.parent = _signalscope.transform; _reticule.localScale = Vector3.one * 0.0005f; _reticule.localPosition = Vector3.forward * 0.5f; _reticule.localRotation = Quaternion.identity; _signalscope.gameObject.AddComponent <ToolModeInteraction>(); var helmetOff = playerHUD.Find("HelmetOffUI/SignalscopeCanvas"); SetupSignalscopeUI(helmetOff); helmetOff.localPosition += Vector3.up * 0.63f; var helmetOn = playerHUD.Find("HelmetOnUI/UICanvas/SigScopeDisplay"); SetupSignalscopeUI(helmetOn); Common.ChangeLayerRecursive(helmetOn.gameObject, "UI"); SetupScopeLens(); }
void Awake() { var translator = Camera.main.transform.Find("NomaiTranslatorProp"); Hands.HoldObject(translator, Hands.RightHand, new Vector3(-0.24f, 0.08f, 0.06f), Quaternion.Euler(32.8f, 0f, 0f)); var translatorGroup = translator.Find("TranslatorGroup"); translatorGroup.localPosition = Vector3.zero; translatorGroup.localRotation = Quaternion.identity; translator.localScale = Vector3.one * 0.3f; var translatorModel = translatorGroup.Find("Props_HEA_Translator"); translatorModel.localPosition = Vector3.zero; translatorModel.localRotation = Quaternion.identity; translator.GetComponent <NomaiTranslator>().SetValue("_raycastTransform", translatorModel); // This child seems to be only for some kind of shader effect. // Disabling it since it looks glitchy and doesn't seem necessary. translatorModel.Find("Props_HEA_Translator_Prepass").gameObject.SetActive(false); var renderers = translatorModel.gameObject.GetComponentsInChildren <MeshRenderer>(true); foreach (var renderer in renderers) { foreach (var material in renderer.materials) { material.shader = Shader.Find("Standard"); } } var texts = translator.gameObject.GetComponentsInChildren <Graphic>(true); foreach (var text in texts) { text.material = null; } var translatorHolster = Instantiate(translatorModel).gameObject; translatorHolster.SetActive(true); var holster = translatorHolster.AddComponent <HolsterTool>(); holster.hand = Hands.RightHand; holster.position = new Vector3(-0.3f, -0.55f, 0); holster.mode = ToolMode.Translator; holster.scale = 0.15f; holster.angle = new Vector3(0, 90, 90); translatorGroup.Find("TranslatorBeams").localScale = Vector3.one / 0.3f; translator.gameObject.AddComponent <ToolModeInteraction>(); }
void Awake() { _itemTool = FindObjectOfType <ItemTool>(); _itemTool.transform.localScale = 1.8f * Vector3.one; Hands.HoldObject(_itemTool.transform.Find("ItemSocket"), Hands.RightHand); Hands.HoldObject(_itemTool.transform.Find("ScrollSocket"), Hands.RightHand, new Vector3(-0.06f, -0.06f, -0.03f), Quaternion.Euler(354f, 104f, 194f)); Hands.HoldObject(_itemTool.transform.Find("SharedStoneSocket"), Hands.RightHand, new Vector3(-0.13f, -0.03f, 0f)); Hands.HoldObject(_itemTool.transform.Find("WarpCoreSocket"), Hands.RightHand, new Vector3(-0.1f, -0.01f, 0.03f), Quaternion.Euler(335f, 34f, 64f)); Hands.HoldObject(_itemTool.transform.Find("VesselCoreSocket"), Hands.RightHand, new Vector3(-0.07f, -0.03f, -0.01f), Quaternion.Euler(31.1f, 70.4f, 26f)); Hands.HoldObject(_itemTool.transform.Find("LanternSocket"), Hands.RightHand); }
void Awake() { var canvas = GameObject.Find("ScreenPromptCanvas").GetComponent <Canvas>(); canvas.gameObject.layer = LayerMask.NameToLayer("VisibleToPlayer"); canvas.transform.localScale = Vector3.one * 0.0015f; canvas.transform.localPosition = Vector3.zero; canvas.transform.localRotation = Quaternion.identity; canvas.renderMode = RenderMode.WorldSpace; canvas.transform.localPosition = Vector3.zero; canvas.transform.localRotation = Quaternion.identity; _holdTransform = Hands.HoldObject(canvas.transform, Hands.RightHand, new Vector3(-0.09f, -0.11f, 0.13f)); foreach (Transform child in canvas.transform) { child.localPosition = Vector3.zero; } }
void Awake() { var scale = Vector3.one * 0.75f; var stickController = Locator.GetPlayerBody().transform.Find("RoastingSystem").GetComponent <RoastingStickController>(); // Move the stick forward while not pressing RT. stickController.SetValue("_stickMinZ", 1f); var stickRoot = stickController.transform.Find("Stick_Root/Stick_Pivot"); stickRoot.localScale = scale; Hands.HoldObject(stickRoot, Hands.RightHand, new Vector3(-0.08f, -0.07f, -0.32f)); var mallow = stickRoot.Find("Stick_Tip/Mallow_Root").GetComponent <Marshmallow>(); void EatMallow() { if (mallow.GetState() != Marshmallow.MallowState.Gone) { mallow.Eat(); } } void ReplaceMallow() { if (mallow.GetState() == Marshmallow.MallowState.Gone) { mallow.SpawnMallow(true); } } bool ShouldRenderMallowClone() { return(stickController.enabled && mallow.GetState() == Marshmallow.MallowState.Gone); } // Eat mallow by moving it to player head. var eatDetector = mallow.gameObject.AddComponent <ProximityDetector>(); eatDetector.other = Common.PlayerHead; eatDetector.minDistance = 0.2f; eatDetector.onEnter += EatMallow; // Hide arms that are part of the stick object. var meshes = stickRoot.Find("Stick_Tip/Props_HEA_RoastingStick"); meshes.Find("RoastingStick_Arm").GetComponent <Renderer>().enabled = false; meshes.Find("RoastingStick_Arm_NoSuit").GetComponent <Renderer>().enabled = false; // Hold mallow in left hand for replacing the one in the stick. var mallowModel = mallow.transform.Find("Props_HEA_Marshmallow"); var mallowClone = Instantiate(mallowModel); mallowClone.GetComponent <MeshRenderer>().material.color = Color.white; mallowClone.localScale = scale; Hands.HoldObject(mallowClone, Hands.LeftHand, new Vector3(0.06f, -0.03f, -0.02f)); // Replace right hand mallow on proximity with left hand mallow. var replaceDetector = mallowClone.gameObject.AddComponent <ProximityDetector>(); replaceDetector.other = mallow.transform; replaceDetector.onEnter += ReplaceMallow; // Render left hand mallow only when right hand mallow is not present. mallowClone.gameObject.AddComponent <ConditionalRenderer>().getShouldRender += ShouldRenderMallowClone; }
void Awake() { var probeLauncher = Camera.main.transform.Find("ProbeLauncher"); probeLauncher.localScale = Vector3.one * 0.2f; Hands.HoldObject(probeLauncher, Hands.RightHand, new Vector3(-0.04f, 0.09f, 0.03f), Quaternion.Euler(45, 0, 0)); _probeLauncherModel = probeLauncher.Find("Props_HEA_ProbeLauncher"); _probeLauncherModel.gameObject.layer = 0; _probeLauncherModel.localPosition = Vector3.zero; _probeLauncherModel.localRotation = Quaternion.identity; _probeLauncherModel.Find("Props_HEA_ProbeLauncher_Prepass").gameObject.SetActive(false); _probeLauncherModel.Find("Props_HEA_Probe_Prelaunch/Props_HEA_Probe_Prelaunch_Prepass").gameObject.SetActive(false); var renderers = probeLauncher.gameObject.GetComponentsInChildren <MeshRenderer>(true); foreach (var renderer in renderers) { if (renderer.name == "RecallEffect") { continue; } foreach (var material in renderer.materials) { material.shader = Shader.Find("Standard"); } } // This one is used only for rendering the probe launcher to the screen in pancake mode, // so we can remove it. probeLauncher.Find("Props_HEA_ProbeLauncher_ProbeCamera").gameObject.SetActive(false); // This transform defines the origin and direction of the launched probe. var launchOrigin = Camera.main.transform.Find("ProbeLauncherTransform").transform; launchOrigin.parent = _probeLauncherModel; launchOrigin.localPosition = Vector3.forward * 0.2f; launchOrigin.localRotation = Quaternion.identity; // Create and adjust hip holster model. _probeLauncherHolster = Instantiate(_probeLauncherModel).gameObject; _probeLauncherHolster.SetActive(false); var holster = _probeLauncherHolster.AddComponent <HolsterTool>(); holster.hand = Hands.RightHand; holster.position = new Vector3(0, -0.55f, 0.2f); holster.mode = ToolMode.Probe; holster.scale = 0.15f; holster.angle = Vector3.right * 90; // Move probe picture to probe launcher. var playerHUD = GameObject.Find("PlayerHUD").transform; var display = playerHUD.Find("HelmetOffUI/ProbeDisplay"); display.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace; display.parent = _probeLauncherModel; display.localScale = Vector3.one * 0.0014f; display.localRotation = Quaternion.identity; display.localPosition = Vector3.forward * -0.8f; _probeUI = display.GetComponent <ProbeLauncherUI>(); var uiCanvas = playerHUD.Find("HelmetOnUI/UICanvas"); uiCanvas.Find("HUDProbeDisplay/Image").gameObject.SetActive(false); var hudProbeDisplay = uiCanvas.Find("HUDProbeDisplay"); hudProbeDisplay.parent = display; hudProbeDisplay.localPosition = Vector3.zero; hudProbeDisplay.localRotation = Quaternion.identity; // Adjust probe picture position. var displayImage = display.GetChild(0).GetComponent <RectTransform>(); displayImage.anchorMin = Vector2.one * 0.5f; displayImage.anchorMax = Vector2.one * 0.5f; displayImage.pivot = Vector2.one * 0.5f; displayImage.localPosition = Vector3.zero; displayImage.localRotation = Quaternion.identity; // Move photo mode bracket to probe launcher. var bracketImage = uiCanvas.Find("BracketImage"); bracketImage.transform.parent = display; bracketImage.localPosition = Vector3.zero; bracketImage.localRotation = Quaternion.identity; bracketImage.localScale *= 0.5f; probeLauncher.gameObject.AddComponent <ToolModeInteraction>(); GlobalMessenger.AddListener("SuitUp", OnSuitUp); GlobalMessenger.AddListener("RemoveSuit", OnRemoveSuit); }