Ejemplo n.º 1
0
    public override BaseNodeRuntime InstantiateRuntimeNode(GameObject gameObj, Type type)
    {
        BaseBehaviourNode node = Activator.CreateInstance(type) as BaseBehaviourNode;

        node.go         = gameObj;
        node.editorNode = this;

        runtimeNode = node;

        return(runtimeNode);
    }
Ejemplo n.º 2
0
    public override void executeTick()
    {
        if (isConditionSatisfied() == false)
        {
            return;
        }

        if (status == RunStatus.Ready)
        {
            onEnter();
        }

        bool canGoOn;

        for (int i = 0; i < _childrenNodes.Count; i++)
        {
            canGoOn = true;

            BaseBehaviourNode childrenNode = _childrenNodes [i];
            RunStatus         nodeStatus   = childrenNode.status;

            switch (nodeStatus)
            {
            case RunStatus.Ready:
            case RunStatus.Running:
                childrenNode.executeTick();
                canGoOn = false;
                break;

            case RunStatus.Completed:
                canGoOn = false;
                status  = RunStatus.Completed;

                return;
            }

            if (canGoOn == false)
            {
                return;
            }
        }

        status = RunStatus.Failure;
        return;
    }
Ejemplo n.º 3
0
 public void addChildren(BaseBehaviourNode children)
 {
     _childrenNodes.Add(children);
 }