Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using Fungus;
- namespace Fungus
- {
- [CommandInfo("Your Custom Commands",
- "Your Custom Command Nr 1",
- "Description of your custom command!")]
- [AddComponentMenu("")]
- public class Fungus_YourCustomCommand : Command
- {
- [Tooltip("You could drag a game object here, or some other component")]
- public GameObject object;
- [Tooltip("String/Float/Integer/BooleanData allow for either value entry or setting a variable")]
- public StringData stringData;
- [Tooltip("String/Float/Integer/BooleanVariable require a Fungus variable to be set")]
- [VariableProperty(typeof(IntegerVariable))]
- public IntegerVariable intVar;
- private int plusint = 1;
- public override void OnEnter()
- { // This is where the magic happens: when this command is reached, everything in here is run.
- // This gets you your flowchart, if you need it
- Flowchart thisFlowchart = GetFlowchart();
- Debug.Log("This is the object you dragged here: " + object);
- // You can't change the variable data in the Flowchart, only locally
- Debug.Log("This is the string: " + stringData);
- // You can read/write the variable info by appending .Value
- Debug.Log("This is the int before: " + intVar.Value);
- // Now we add our private int variable to it, and then log it again
- intVar.Value +=plusint;
- Debug.Log("This is the int after: " + intVar.Value);
- OnWaitComplete();
- }
- void OnWaitComplete()
- { // Continue() is what tells the Flowchart the command is finished and needs to continue to the next one
- Continue();
- }
- public override Color GetButtonColor()
- { // This lets you set some other colour than just white!
- return new Color32(17, 120, 131, 255);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement