Beispiel #1
0
        protected override NodeState Execute()
        {
            if (Child == null)
            {
                return(NodeState.NoResult);
            }
            if (startTime < 0)
            {
                startTime = Time.time;
            }
            else
            {
                if ((Time.time - startTime) >= maxSeconds)
                {
                    Child.Abort();
                    startTime = -1;
                    return(NodeState.Failure);
                }
            }
            var result = ExecuteNode(Child);

            if (result == NodeState.Success)
            {
                return(result);
            }
            else
            {
                return(NodeState.ContinueNextFrame);
            }
        }
Beispiel #2
0
        protected override Status Update()
        {
            if (_condition.Tick() != Status.Success)
            {
                Child.Abort();
                return(Status.Success);
            }

            Child.Tick();

            return(Status.Running);
        }