playMaker

Author Topic: How do i get Playmaker and NGUI talking? [SOLVED]  (Read 2824 times)

DNG

  • Playmaker Newbie
  • *
  • Posts: 5
How do i get Playmaker and NGUI talking? [SOLVED]
« on: April 24, 2014, 05:16:52 AM »
Hi,

I'm working on 2D side scrolling fighter and i'm using mecanim for movement and smoothmoves for playing sprite anim's. My player movement is setup using a 360 controller and keyboard and everything works great so far! but i'm having a really hard time with getting NGUI to talk to my player FSM's and I'm up to date  with everything as far as software goes. So my question is how do i get my player movement FSM's to work with NGUI?

Thanks,

DNG
« Last Edit: May 16, 2014, 10:30:22 PM by Alex Chouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How do i get Playmaker and NGUI talking?
« Reply #1 on: April 25, 2014, 08:19:51 AM »
Hi,

 can you give a concrete exampe? do you want a ngui button to call a PlayMaker event or something like that?

bye,

 Jean

DNG

  • Playmaker Newbie
  • *
  • Posts: 5
Re: How do i get Playmaker and NGUI talking?
« Reply #2 on: April 28, 2014, 03:31:49 AM »
Hi Jean,

Thanks for getting back to me.

Basically my game is using a keyboard and a Xbox 360 controller for inputs through Unity's input manger, this is great for Windows or Mac desktops. But i want to be able to run this game on a iphone and ipad as well.

Here are some examples of a similar fighting game control scheme:

https://www.dropbox.com/s/ubegmues9vz7m5n/KFW1.jpg
https://www.dropbox.com/s/wkt2ilbf2ioz9wq/KungFu%20W.mov

How do i take my existing control scheme, and move it to a GUI interface so that i can run my game on a iphone or any device using NGUI?


Thanks,

Derek

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How do i get Playmaker and NGUI talking?
« Reply #3 on: April 28, 2014, 06:15:50 AM »
Hi,

 You'll need to use the PlayMaker ngui package from the wiki:

https://hutonggames.fogbugz.com/?W1111

 read the whole page, it explains at the bottom how to bind ngui events to PlayMaker events, then you'll be able to catch then the user is pressing down ngui sprites, buttons etc.

bye,

 Jean

DNG

  • Playmaker Newbie
  • *
  • Posts: 5
Re: How do i get Playmaker and NGUI talking?
« Reply #4 on: April 29, 2014, 07:19:35 PM »
Hi Jean,

Thanks,

NGUI is now catching the targeted FSM that controls my player movement, but it’s not catching the horizontal input axes and the variable that handles the player moveSpeed. 

So when I tap and hold the GUI button to run left or right nothing happens?

Using the setup on the wiki, how do I setup NGUI to pick up the horizontal input axes as well as the moveSpeed of my player?

An example file would really be helpful as the current sample files do not demonstrate this type of work flow.


Thanks,

D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How do i get Playmaker and NGUI talking?
« Reply #5 on: April 30, 2014, 03:52:33 AM »
Hi,

 I think you are confused.

you have to bind the player movement yourself, and if the value comes from ngui that's ok, but ngui as is will not talk directly to your player, you have to glue this together.

so, when you receive the event that the gui button is down, you need to then call your player and tell it to move.

bye,

 Jean

DNG

  • Playmaker Newbie
  • *
  • Posts: 5
Re: How do i get Playmaker and NGUI talking?
« Reply #6 on: May 14, 2014, 01:28:59 PM »
 Hi Jean,

It's working now.

I noticed when I set the "NGuiEventsToPlaymakerFsmEvents" component to target an FSM it only sees the first attachment.  Is this a limitation of the script?  Cause normally you would have multiple FSM’s on one game object.  Is there a way to see multiple FSM’s on a game object using this script?

Thanks,
D.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How do i get Playmaker and NGUI talking?
« Reply #7 on: May 15, 2014, 01:07:55 AM »
Hi,

 yes, it gets it automatically for you, but you can always drag another fsm from that gameobject ( or another, it doesn't have to be on the same gameobject)

the fsm target is a property so you can edit/change it.

bye,

 Jean

DNG

  • Playmaker Newbie
  • *
  • Posts: 5
Re: How do i get Playmaker and NGUI talking?
« Reply #8 on: May 16, 2014, 02:47:24 PM »
Hi Jean,

Everything is working thanks for your help!

D.