Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- namespace HutongGames.PlayMaker.Actions
- {
- //[ActionCategory(ActionCategory.Animation)]
- //OR
- //[ActionCategory("CATEGORY NAME")]
- [Tooltip("Tooltip for action goes here")]
- public class _ExampleAction : FsmStateAction {
- [UIHint(UIHint.Variable)] //advanced: helps playmaker choose the most best editor for type of variable
- public FsmFloat exampleFloat; //using an "fsm" version of a variable allows you to subsitute in at runtime, if a variable type doesnt have one just use the normal version
- [RequiredField] //makes a field required
- [Tooltip("Tooltip for variables go here")] //allows you to over variable name to see what its for
- public FsmEvent sendEvent; //used to broadcast an event to a fsm
- public bool everyFrame;
- //allows you to set default values for variables here when you use reset in the inspector
- public override void Reset()
- {
- everyFrame = false;
- }
- public override void OnEnter()
- {
- //a common addition to playmaker actions. this will allow the action to update more than once while the state it belongs to is active
- if (!everyFrame)
- Finish(); //stops OnUpdate() and runs OnExit()
- }
- //run every frame the state the action belongs to is active and Finish() has not been called
- public override void OnUpdate()
- {
- }
- //run every frame AFTER OnUpdate(), same rules apply as above
- //tip: should be used instead of OnUpdate() if physics is involved
- public override void OnFixedUpdate()
- {
- }
- //run every frame AFTER OnUpdate(), same rules apply as above
- public override void OnLateUpdate()
- {
- }
- //run when Finish() is called
- public override void OnExit()
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement