"As a designer and artist without strong coding skills, with Playmaker I’m able to bring my ideas to life without any limits."
- Micah Betts
"Working with Playmaker is like drawing my ideas on paper.
I am a veteran coder but I love to see my code ideas in a snapshot."
Ruben Alcaniz
"I would have never released a game if it wasn’t for Playmaker.
For artists like myself, it opens up a new world."
David Wehle
“That’s something we’ve used in the game to create scripted events alongside our animation system. It was actually a big help in enabling our art team to independently make cool events in-game.”
Playmaker uses event-driven FSMs to control Unity
The currently active state executes Actions.
Actions have parameters that can be edited in the Action Editor.
A variable is a named container for a value. Action parameters accept variables as well as hard-coded values.
A variable has several advantages over a hard-coded value:
All transitions between States are triggered by Events.
Use the Event Manager to add/edit Events.
There are 2 basic types of Events:
1. System Events: Sent automatically by Unity/Playmaker;
cannot be edited or deleted.
2. User Events: Custom events that you can use however you want.
Any FSM can be saved as a Template that can then be re-used.
Templates also let you nest FSMs, so you can build reusable blocks that can be run wherever you need them.
public class Root : MonoBehaviour {
[Range(1, 20)]
public int botsAmout;
[Range(10, 40)]
public int bulletsAmout;
void Start () {
FsmVariables.GlobalVariables.FindFsmInt ("CONST_BOTS_AMOUNT").Value = botsAmout;
FsmVariables.GlobalVariables.FindFsmInt ("CONST_BULLETS_AMOUNT").Value = bulletsAmout;
}
}
Setting Global Variables from C# code with static methods from Playmaker API.
1. Initialization of the game entities (unit, containers, bots).
Loop with events.
2. Setting GUI values.
Move to Click FSM: Waiting for MouseClick and use "Move Toward" action to animate Unit to the position. During the "Move" state we can choose another point (Duplication).
Look at cursor: Simple "Look At" action repeated every frame.
Marine_Gun - "Fire the bullet" FSM is responsible for:
- creating a bullet
- checking amount of possible shots
- setting the "Bullets: #" GUI text
1. Bullet has a kinetic "Rigidbody Component" and waiting for collision trigger event, which filtered based on the tag
2. Bullet signalizes to the "hitted" bot's FSM (which is stored in the local variable) about collision by "Send Event" action.
Bot then handling that collision by himself with event: DESTROY_BOT
1
2
Bot moving in the same way as bullet. On that state we are listening for global event - DESTROY_BOT which might come only from bullet.
Bot must have a "Rigidbody Component"
To be able to set text to UGUI text field (Unity.version > 4.6) we need special action which is not included by default:
- U Gui Text Set Text.
We can find it with special add-on "Ecosystem Browser"
Before combining "string" with an integer values, these "integers" must be converted to "string" (Convert Int to String).
Playmaker
- Addons
- Ecosystem
- Ecosystem Browser