public bool LookThroughSpyglass() { IsInUse = true; if (LookerRoot == null) { LookerRoot = new GameObject("SpyglassLookerRoot").transform; LookerTransform = LookerRoot.gameObject.CreateChild("LookerTransform").transform; } LookerRoot.rotation = Player.Local.Rotation; LookerRoot.position = Player.Local.HeadPosition; LookerTransform.localPosition = Player.Local.ForwardVector * SpyglassSkill.EffectRadius; //set the looker to the player's head position & rotation worlditem.tr.LookAt(LookerTransform); GameObject childEditor = GUIManager.SpawnNGUIChildEditor(gameObject, GUIManager.Get.Dialog("NGUIMessageActionDialog")); mChildEditor = childEditor.GetComponent <GUIMessageActionDialog>(); MessageActionDialogResult editObject = new MessageActionDialogResult(); editObject.Message = "Spyglass (unequip to exit)"; editObject.CloseOnAction1 = false; editObject.CloseOnAction2 = false; editObject.Prompt1 = new GUIHud.HudPrompt(UserActionType.MoveJump, "Place Marker"); editObject.Prompt2 = new GUIHud.HudPrompt(UserActionType.ToolCycleNext, "Mode"); mChildEditor.OnDidAction1 += OnPlacedMarker; mChildEditor.OnDidAction2 += OnCycleMode; GUIManager.SendEditObjectToChildEditor <MessageActionDialogResult>(new ChildEditorCallback <MessageActionDialogResult>(ReceiveFromChildEditor), mChildEditor.gameObject, editObject); enabled = true; return(true); }
public void ReceiveFromChildEditor(MessageActionDialogResult editObject, IGUIChildEditor <MessageActionDialogResult> childEditor) { if (mFinished) { return; } mChildEditor = null; OnUnequip(); }
public void ReceiveFromChildEditor(MessageActionDialogResult editObject, IGUIChildEditor <MessageActionDialogResult> childEditor) { if (TakingOff) { mChildEditor = null; return; } if (editObject.DidAction1) { TakingOff = true; StartCoroutine(TakeOffOverTime(glider)); } mChildEditor = null; }
public void Update() { //only show the dialog if we have the skill if (!Skills.Get.HasLearnedSkill("HangGlider")) { return; } //if we're taking off, update that and close the dialog if (TakingOff) { if (mChildEditor != null) { mChildEditor.Finish(); mChildEditor = null; } enabled = false; return; } //if the player is holding the glider and we're not showing the dialog, show it now if (Player.Local.Tool.HasWorldItem && Player.Local.Tool.worlditem.Is <Glider>(out glider)) { if (mChildEditor == null) { GameObject childEditor = GUIManager.SpawnNGUIChildEditor(gameObject, GUIManager.Get.Dialog("NGUIMessageActionDialog")); mChildEditor = childEditor.GetComponent <GUIMessageActionDialog>(); MessageActionDialogResult editObject = new MessageActionDialogResult(); editObject.Message = "Launch Point"; editObject.Prompt1 = new GUIHud.HudPrompt(UserActionType.MoveJump, "Take Off"); editObject.CloseOnAction1 = true; GUIManager.SendEditObjectToChildEditor <MessageActionDialogResult>(new ChildEditorCallback <MessageActionDialogResult>(ReceiveFromChildEditor), mChildEditor.gameObject, editObject); } } else { //if the player is not holding the glider and we're showing the child editor, close it now if (mChildEditor != null) { mChildEditor.Finish(); mChildEditor = null; } } }