Exemplo n.º 1
0
 public override void Checkin(Machine machine, NodeFollower context)
 {
     if (stateMethods.ContainsKey(machine))
     {
         stateMethods[machine]();
     }
 }
Exemplo n.º 2
0
 public override void OnEncountered(Node prevNode, Machine machine, NodeFollower context)
 {
     if (!Valid)
     {
         Debug.LogError("Encountered an invalid state! Check the referenced class exists and extends State");
     }
 }
Exemplo n.º 3
0
 public override void OnEncountered(Node prevNode, Machine machine, NodeFollower context)
 {
     if (runOnEncounter)
     {
         Checkin(machine, context);
     }
 }
Exemplo n.º 4
0
 public override void Checkin(Machine machine, NodeFollower context)
 {
     if (followers[context].Active)
     {
         machine.UpdateCurrents(followers[context].Checkin());
     }
 }
Exemplo n.º 5
0
        public override void OnRunEnd(Machine machine, NodeFollower context)
        {
            if (followers == null)
            {
                followers = new Dictionary <NodeFollower, NodeFollower>();
            }

            followers.Remove(context);
        }
Exemplo n.º 6
0
 public override void OnEncountered(Node prevNode, Machine machine, NodeFollower context)
 {
     if (!Valid)
     {
         Debug.LogError("Encountered an invalid state! Check the referenced class exists and extends State");
         return;
     }
     if (eventMethods.ContainsKey(machine))
     {
         eventMethods[machine]();
     }
 }
Exemplo n.º 7
0
 public override void OnEncountered(Node prevNode, Machine machine, NodeFollower context)
 {
     if (!logProp)
     {
         Debug.Log(message);
     }
     else
     {
         try {
             Debug.Log(machine.name + " > " + propName + ": " + machine.GetProp(propName));
         } catch (KeyNotFoundException) {
             Debug.LogError("Could not debug " + machine.name + " > " + propName + " - prop not found!");
         }
     }
 }
Exemplo n.º 8
0
        public override void OnRunStart(Machine machine, NodeFollower context)
        {
            if (followers == null)
            {
                followers = new Dictionary <NodeFollower, NodeFollower>();
            }

            if (!followers.ContainsKey(context))
            {
                FunctionNode funcNode = machine._model.GetFunction(function);
                if (funcNode != null)
                {
                    followers.Add(context, new NodeFollower(machine, funcNode, context, continuous));
                }
                else
                {
                    Debug.LogError("Attempted to run non-existent function " + function + "!");
                }
            }
        }
Exemplo n.º 9
0
 // Update is called once per frame
 void FixedUpdate()
 {
     foreach (NodeFollower nf in waiting)
     {
         nf.deactivate = true;
     }
     if (waiting.Count == 1)
     {
         waiting[0].deactivate = false;
     }
     if (waiting.Count > 0)
     {
         if (waiting[0].stop)
         {
             NodeFollower bad = waiting[0];
             waiting.Remove(waiting[0]);
             waiting.Add(bad);
         }
         else
         {
             waiting[0].deactivate = false;
         }
     }
 }
Exemplo n.º 10
0
        public override void OnEncountered(Node prevNode, Machine machine, NodeFollower context)
        {
            if (followers == null)
            {
                followers = new Dictionary <NodeFollower, NodeFollower>();
            }

            if (!followers.ContainsKey(context))
            {
                FunctionNode funcNode = machine._model.GetFunction(function);
                if (funcNode != null)
                {
                    followers.Add(context, new NodeFollower(machine, funcNode, context, true));
                }
                else
                {
                    Debug.LogError("Attempted to run non-existent function " + function + "!");
                }
            }
            if (followers[context].Active)
            {
                machine.UpdateCurrents(followers[context].Checkin());
            }
        }
Exemplo n.º 11
0
 public override void Checkin(Machine machine, NodeFollower context)
 {
 }
Exemplo n.º 12
0
 public override void OnPassed(HashSet <Node> nextNodes, Machine machine, NodeFollower context)
 {
     triggered = false;
 }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     nf = control.GetComponent <NodeFollower>();
 }
Exemplo n.º 14
0
 /// <summary>
 ///  Triggered when this node is passed while the machine is searching for the next node.
 /// </summary>
 /// <remarks>
 ///  Note: if the model does not support parallel flow, then only the first element of <c>nextNodes</c> will be followed.
 /// </remarks>
 public virtual void OnPassed(HashSet <Node> nextNodes, Machine machine, NodeFollower context)
 {
 }
Exemplo n.º 15
0
 public virtual void OnRunEnd(Machine machine, NodeFollower context)
 {
 }
Exemplo n.º 16
0
 public abstract void Checkin(Machine machine, NodeFollower context);
Exemplo n.º 17
0
 public override void OnEncountered(Node prevNode, Machine machine, NodeFollower context)
 {
     conditionMet = ConditionMet(machine);
 }
Exemplo n.º 18
0
 /// <summary>
 ///  Triggered when this node is encountered while the machine is searching for the next node.
 /// </summary>
 public virtual void OnEncountered(Node prevNode, Machine machine, NodeFollower context)
 {
 }