public void Init() { EffectsScript = GetComponent <ViveSR_Experience_Effects>(); PortalScript = GetComponent <ViveSR_Experience_Portal>(); dartGenerator = PortalScript.dartGeneratorMgr_portal.GetComponent <ViveSR_Experience_IDartGenerator>(); GameObject attachPointCanvas = ViveSR_Experience.instance.AttachPoint.transform.GetChild(ViveSR_Experience.instance.AttachPointIndex).transform.gameObject; LeftHint = attachPointCanvas.transform.Find("TouchpadCanvas/LeftText").gameObject; RightHint = attachPointCanvas.transform.Find("TouchpadCanvas/RightText").gameObject; TriggerHint = attachPointCanvas.transform.Find("TriggerCanvas").gameObject; PortalScript.SetPortal(true); ViveSR_Experience_ControllerDelegate.triggerDelegate += HandleTrigger_ThrowableItemUI; ViveSR_Experience_ControllerDelegate.touchpadDelegate += HandleTouchpad_ControlPortal; ViveSR_Experience_ControllerDelegate.gripDelegate += HandleGrip_SwitchEffects; PortalScript.Init(); }
public void SwitchPlacementMode() { if (AllowSwitchingTool) { ViveSR_Experience_IDartGenerator oldDartGenerator = DartGenerators[dartPlacementMode]; oldDartGenerator.TriggerRelease(); GameObject lastObj = oldDartGenerator.InstantiatedDarts[oldDartGenerator.InstantiatedDarts.Count - 1]; Destroy(lastObj); oldDartGenerator.enabled = false; //switch to the other DartGenerator dartPlacementMode = (DartPlacementMode)(((int)dartPlacementMode + 1) % (int)DartPlacementMode.MaxNum); ViveSR_Experience_IDartGenerator newDartGenerator = DartGenerators[dartPlacementMode]; newDartGenerator.enabled = true; newDartGenerator.TriggerPress(); } }
void SetDartGeneratorMessage(bool isTriggerDown) { string targetLine = ""; // sphere = 0, // deer = 1, // dart = 2, if (isTriggerDown) { if (dartGeneratorMgr_Static.isActiveAndEnabled || dartGeneratorMgr_Dynamic.isActiveAndEnabled) { ViveSR_Experience_DartGeneratorMgr currentMgr = dartGeneratorMgr_Static.isActiveAndEnabled ? dartGeneratorMgr_Static : dartGeneratorMgr_Dynamic; ViveSR_Experience_IDartGenerator DartGenerator = currentMgr.DartGenerators[currentMgr.dartPlacementMode]; if (DartGenerator.currentDartPrefeb == 2) { targetLine = "Trigger(Dart)"; } else if (DartGenerator.currentDartPrefeb == 0) { targetLine = "Trigger(Sphere)"; } else if (DartGenerator.currentDartPrefeb == 1) { targetLine = "Trigger(ViveDeer)"; } tutorial.SetCanvasText(TextCanvas.onRotator, tutorial.MainLineManagers[Button.ButtonType].mainLines.First(x => x.messageType == targetLine).text); } } else { SetSubBtnMessage(); } tutorial.SetCanvas(TextCanvas.onTrigger, !isTriggerDown); }
void SetTriggerMessage(bool isTriggerDown) { if (!DartGenerator) { DartGenerator = dartGeneratorMgr_portal.DartGenerators[dartGeneratorMgr_portal.dartPlacementMode]; } string targetLine = ""; if (isTriggerDown) { if (DartGenerator.isActiveAndEnabled) { if (DartGenerator.currentDartPrefeb == 2) { targetLine = "Trigger(Sword)"; } else if (DartGenerator.currentDartPrefeb == 0) { targetLine = "Trigger(Sphere)"; } else if (DartGenerator.currentDartPrefeb == 1) { targetLine = "Trigger(ViveDeer)"; } ViveSR_Experience_IButton CurrentButton = ViveSR_Experience_Demo.instance.Rotator.CurrentButton; tutorial.SetCanvasText(TextCanvas.onRotator, tutorial.MainLineManagers[CurrentButton.ButtonType].mainLines.First(x => x.messageType == targetLine).text); } } else { tutorial.SetMainMessage(); } }