Esempio n. 1
0
 public void callback(Callback.Type cb)
 {
     foreach (BehaviourTrigger bt in behaviourTriggers)
     {
         bt.trigger(cb);
     }
 }
    //TODO out
    public void trigger(Callback.Type type)
    {
        //Debug.Log("trigger:" + type);
        //TODO 子节点检测
        if (callback != type)
        {
            return;
        }

        if (!enable || reflexes == null)
        {
            return;
        }

        foreach (Reflex r in reflexes)
        {
            bool result = true;

            foreach (Condition c in r.conditions)
            {
                if (c.isTrue() == false)
                {
                    result = false;
                    break;
                }
            }

            if (result == false)
            {
                continue;
            }

            foreach (Operation op in r.operations)
            {
                //TODO probability
                op.operate();
            }
        }
    }
 public BehaviourTrigger setCallback(Callback.Type type)
 {
     this.callback = type;
     return(this);
 }