playMaker

Author Topic: Converting from C# to PlayMaker  (Read 121 times)

yigitkahraman

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Converting from C# to PlayMaker
« on: April 06, 2019, 08:21:55 AM »
Hello, I bought PlayMaker recently. I have a turn based game prototype that is became quite large and difficult to maintain (mostly because of bug hunting).

Honestly, i don't really grasp the basics of playmaker fully yet. I made couple of working custom actions, nonetheless. My codebase has its own event bus and state machine.

If I am to convert it, i need answers of some questions; bear with me hear, please:

I have a mission manager that handles which characters will be spawned in level, how many enemies etc. In code, i use an event to carry character list (which is in a missionData scriptableObject) to Battle Manager. Battle Manager, send this list to Grid Manager to spawn characters. Sort the characters based on their stat (Initiative), start the first characters turn etc.
GridManager triggers and event for InterfaceManager to create character interfaces etc. This thing goes and goes, as you can imagine.
Question is though, how can i make this work? How can i communicate between Managers like this?

Thank you in advance.


Farwest

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 49
    • View Profile
Re: Converting from C# to PlayMaker
« Reply #1 on: April 07, 2019, 05:18:27 AM »
Merhaba Yiğit,
Firstly, I do suggest you to check how Arrays work in Playmaker. Because it seems that you are relying on sending many variables from one object to another.

Also there are examples how Script variables can be saved to Playmaker variables, please have a look at them, because I guess you will want to send your Array variables to Playmaker FSM Array variables considering the job you are doing now.
example1, example2

As you transmit your arrays to Playmaker FSM, by using Array Get Next, you can easily process all variables of an Array with a loop. Simply create a transition from Loop Event slot to another state, as Array gets any object or variable, you process them in the State that you sent the transition. Then you return the transition back to
the Array Get Next again, and that state will process all the items in an array. As array is fully processed, use End Event to transition to your next job if there is any.

Learn how Array Get Next can be used well, it is very handy.

There are also a lot of tutorials in youtube regarding all aspects of Playmaker, I am sure they will be useful in your works too.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4106
    • View Profile
    • jinxtergames
Re: Converting from C# to PlayMaker
« Reply #2 on: April 07, 2019, 07:57:26 AM »
Hi.
Here is a link to the playmaker API reference page.

There are some samples on how to communicate with playmaker from scripts.