private void CloseMenu() { if (SituationPanel == null) { SituationPanel = FindObjectOfType <SituationInfoUI>(); } if (VRMovementPlayer == null) { VRMovementPlayer = FindObjectOfType <VRMovement>(); } VRMovementPlayer.SetCanMove(true); SituationPanel.UnPause(); OptionPanel.OpenOption(false); }
protected override void Awake() { base.Awake(); if (!Application.isPlaying) { return; } GetComponent <Canvas>().worldCamera = FindObjectOfType <VRMovement>().cam; user = FindObjectOfType <VRMovement>(); rect = GetComponent <RectTransform>(); raycaster = GetComponent <OVRRaycaster>(); raycaster.pointer = FindObjectOfType <OVRGazePointer>().gameObject; target = Camera.main.transform; }
//Set reference private void Start() { creationArea = FindObjectOfType <SpellCreation>(); playerBody = GetComponentInParent <VRMovement>(); camTransform = gameObject.transform.parent.GetComponentInChildren <Camera>().transform; if (creationArea != null) { for (int i = 0; i < 5; i++) { slotAnimators[i] = creationArea.transform.GetChild(11 + i).GetComponent <Animator>(); slotInfo[i] = creationArea.transform.GetChild(1 + i).GetComponent <AttachCrystal>(); } } }
private void Init() { Transform _independent = transform.Find("Independent"); if (!_independent.gameObject.activeInHierarchy) { GameObject _player = Instantiate(Resources.Load <GameObject>("Prefabs/GamePlay/TrainingItems/Player")); SetNormalPosition(_player); GameObject _hud = Instantiate(Resources.Load <GameObject>("Prefabs/GamePlay/TrainingItems/TutorialHUD")); SetNormalPosition(_hud); GameObject _clone = Instantiate(Resources.Load <GameObject>("Prefabs/GamePlay/TrainingItems/SAFETY_AWARENESS")); SetNormalPosition(_clone); trainingChapter = _clone; _clone = Instantiate(Resources.Load <GameObject>("Prefabs/GamePlay/TrainingItems/ValveOperations")); SetNormalPosition(_clone); valveChapter = _clone; _clone = Instantiate(Resources.Load <GameObject>("Prefabs/GamePlay/TrainingItems/DRILLING_RIG_UP")); SetNormalPosition(_clone); drillingChapter = _clone; _clone = Instantiate(Resources.Load <GameObject>("Prefabs/GamePlay/TrainingItems/EmergencySituation")); SetNormalPosition(_clone); EmergencySituation = _clone; } else { trainingChapter = _independent.Find("SAFETY_AWARENESS").gameObject; valveChapter = _independent.Find("ValveOperations").gameObject; drillingChapter = _independent.Find("DRILLING_RIG_UP").gameObject; EmergencySituation = _independent.Find("EmergencySituation").gameObject; } fireBoxInfo = FindObjectOfType <FireBoxInfo>(); situationInfoUI = FindObjectOfType <SituationInfoUI>(); hazardInfo = FindObjectOfType <HazardInfo>(); vRMovement = FindObjectOfType <VRMovement>(); DeactivateCurrentChapter(); }
//Setup target platform if it is not already setup. Set up cursor and destroy objects based on platform private void Awake() { AudioSource[] sources = GameObject.FindObjectsOfType <AudioSource>(); PersistentBGM bgm = FindObjectOfType <PersistentBGM>(); if (bgm == null) { bgm = Instantiate(bgmControll).GetComponent <PersistentBGM>(); } if (SceneManager.GetActiveScene().name.Contains("Menu")) { if (bgm.GetComponent <AudioSource>().clip != clips[0]) { bgm.GetComponent <AudioSource>().clip = clips[0]; bgm.GetComponent <AudioSource>().Play(); } } else if (Info.currentGameMode == GameMode.Challenge) { if (bgm.GetComponent <AudioSource>().clip != clips[1]) { bgm.GetComponent <AudioSource>().clip = clips[1]; bgm.GetComponent <AudioSource>().Play(); } } else { if (bgm.GetComponent <AudioSource>().clip != clips[2]) { bgm.GetComponent <AudioSource>().clip = clips[2]; bgm.GetComponent <AudioSource>().Play(); } } if (Info.optionsData != null) { bgm.GetComponent <AudioSource>().volume = Info.optionsData.bgmLevel; } if (Info.targetPlatform == Platform.Unset) { if (targetPlatform == Platform.Unset) { targetPlatform = Platform.PC; } Info.targetPlatform = targetPlatform; } if (Info.IsCurrentlyVR()) { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; foreach (PCCraftingZone obj in FindObjectsOfType <PCCraftingZone>()) { destroyOnVR.Add(obj.gameObject); } foreach (SpellCreation table in FindObjectsOfType <SpellCreation>()) { foreach (AttachCrystal obj in table.PCSpellSlots) { destroyOnVR.Add(obj.gameObject); } } PlayerController player = FindObjectOfType <PlayerController>(); if (player != null) { destroyOnVR.Add(player.gameObject); } foreach (GameObject obj in destroyOnVR) { Destroy(obj); } } else { if (SceneManager.GetActiveScene().name != "PC Menu") { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } else { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; } foreach (DestroyCrstalRange obj in FindObjectsOfType <DestroyCrstalRange>()) { destroyOnPC.Add(obj.gameObject); } foreach (SpellCreation table in FindObjectsOfType <SpellCreation>()) { foreach (AttachCrystal obj in table.VRSpellSlots) { destroyOnPC.Add(obj.gameObject); } } VRMovement player = FindObjectOfType <VRMovement>(); if (player != null) { destroyOnPC.Add(player.gameObject); } foreach (GameObject obj in destroyOnPC) { Destroy(obj); } } if (Info.optionsData == null) { Info.optionsData = SaveSystem.LoadOptions(); } }
// Start is called before the first frame update void Start() { movementDummy = GetComponent <VRMovement>(); }
private void Awake() { mover = GetComponent <VRMovement>(); }