playMaker

Author Topic: [SOLVED] disable mouselook ( like ingame options menu )  (Read 3875 times)

Martin-Vaupell

  • Junior Playmaker
  • **
  • Posts: 70
  • Creating CarbonDiOxide
    • Evisystems
[SOLVED] disable mouselook ( like ingame options menu )
« on: December 30, 2013, 09:26:20 AM »
Scene/situation plan

FirstPersonPlayer walks up to a screen, Hits use and i get the popUp of the screen on the UI, player types something then clicks save, and walks away!

Tools

I'm using NGUI,Playmaker, NGUI scripts for PlayMaker.
FirstPerson controller from Unity standard assets.

What is working as intended
I walk up, get the 'press use button' and the pop up shows just fine,
when i cancel by walking away or exiting it closes just fine.


Problem

When the NGUI popup is active i want to disable "mouseLook" component in the player asset. Then enable normal mouse use.

And then ofcourse by cancelling disable mouse/re enable mouselook on the player.


Considerations


If i where scripting this, i would maybe edit the player script itself to include something like this..
Code: [Select]
void Start ()
    {
        noMouse = GetComponent<Mouse look>();
    }
   
   
    void Update ()
    {
        if(Input.GetKeyUp(KeyCode.E))
        {
            noMouse.enabled = !noMouse.enabled;
        }
    }

But then it could actually enable or disable when it should not,
so I'm trying to work this in from playMaker on the computer itself.

I was considering maybe use playmaker on the computer to set a globalVar and maybe add FSM to player just checking that globalvar constantly

The Computer


The Player component i want to change state on.



Solution

Well I'm not sure where to start to achieve this, so that's basically why I'm here.
Open to suggestions or better solutions to the same porblem.


;)  Vaupell


EDIT ADD : Just realized this is the same thing you would want to do
if you where to have a Ingame options menu.

ie. Hit esc/pause and being able to use the mouse there.
« Last Edit: December 30, 2013, 10:55:56 AM by VaupellAgainNoMailReceive »

Martin-Vaupell

  • Junior Playmaker
  • **
  • Posts: 70
  • Creating CarbonDiOxide
    • Evisystems
Re: disable mouselook, enable mouse ( like ingame options menu )
« Reply #1 on: December 30, 2013, 10:55:23 AM »

Solved..

To easy!

All i had to do was use the "Set Property"
and i got that by simply "dragging" the ACTUAL script component into FSM.

Disabled on use and re enabled when leaving the terminal..  AWESOME!!




Next stop - How to enable to mouse while there :p

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [SOLVED] disable mouselook ( like ingame options menu )
« Reply #2 on: December 30, 2013, 03:38:49 PM »
Hi,

 You'll need to have two fsms or at least have two states, one with your mouse behaviour enabled. one without, else you fire a global event "ENABLE MOUSE" "DISABLE MOUSE" or something and another fsm will simply listen to them two events and switch between two states, one with mouse behavior, one without.

bye,

 Jean