Beispiel #1
0
        public override BTResult Tick()
        {
            if (activeChild == null)
            {
                activeChild = children[0];
                activeIndex = 0;
            }

            BTResult _res = activeChild.Tick();

            if (_res == BTResult.Ended)
            {
                activeIndex += 1;
                if (activeIndex >= children.Count)
                {
                    activeChild.Reset();
                    activeChild = null;
                    activeIndex = -1;
                }
                else
                {
                    activeChild.Reset();
                    activeChild = children[activeIndex];
                    _res        = BTResult.Running;
                }
            }
            return(_res);
        }
Beispiel #2
0
        public override BTResult Tick()
        {
            if (activeChild == null)
            {
                return(BTResult.Ended);
            }

            BTResult _res = activeChild.Tick();

            if (_res != BTResult.Running)
            {
                activeChild.Reset();
                activeChild = null;
            }

            return(_res);
        }