Beispiel #1
0
 public void Tick(float delta)
 {
     if (_Result == TICKRESULT.RUNNING)
     {
         var result = _Child.Tick(delta);
         _Result = result;
     }
 }
Beispiel #2
0
        public void ActionTick()
        {
            var node = new ActionNode <NumberTestNode>(() => new NumberTestNode(3)
                                                       , (ntn) => ntn.Tick
                                                       , (ntn) => ntn.Start
                                                       , (ntn) => ntn.End);
            ITicker ticker  = node;
            var     result1 = ticker.Tick(0);

            ticker.Tick(0);
            var result2 = ticker.Tick(0);
            var result3 = ticker.Tick(0);


            NUnit.Framework.Assert.AreEqual(TICKRESULT.RUNNING, result1);
            NUnit.Framework.Assert.AreEqual(TICKRESULT.SUCCESS, result2);
            NUnit.Framework.Assert.AreEqual(TICKRESULT.FAILURE, result3);
        }
Beispiel #3
0
        public TICKRESULT Tick(float delta)
        {
            if (_RunninTicker != null)
            {
                var resultRunner = _RunninTicker.Tick(delta);

                if (resultRunner == TICKRESULT.RUNNING)
                {
                    return(TICKRESULT.RUNNING);
                }

                _RunninTicker = null;
                if (resultRunner == TICKRESULT.FAILURE)
                {
                    _Queue.Clear();
                    return(TICKRESULT.FAILURE);
                }

                if (_Queue.Count == 0)
                {
                    return(TICKRESULT.SUCCESS);
                }
            }

            if (_Queue.Count == 0)
            {
                _Reload();
            }

            _CurrentTicker = _Queue.Dequeue();
            var result = _CurrentTicker.Tick(delta);

            if (result == TICKRESULT.FAILURE)
            {
                _Queue.Clear();
                return(TICKRESULT.FAILURE);
            }


            if (result == TICKRESULT.RUNNING)
            {
                _RunninTicker = _CurrentTicker;
                return(TICKRESULT.RUNNING);
            }

            if (_Queue.Count == 0)
            {
                return(TICKRESULT.SUCCESS);
            }

            return(TICKRESULT.RUNNING);
        }
Beispiel #4
0
        TICKRESULT ITicker.Tick(float delta)
        {
            var result = _Ticker.Tick(delta);

            if (result == TICKRESULT.FAILURE)
            {
                return(TICKRESULT.SUCCESS);
            }
            else if (result == TICKRESULT.SUCCESS)
            {
                return(TICKRESULT.FAILURE);
            }
            return(result);
        }
Beispiel #5
0
 public void Tick()
 {
     _iTicker.Tick();
 }
Beispiel #6
0
 TICKRESULT ITicker.Tick(float delta)
 {
     _Ticker.Tick(delta);
     return(TICKRESULT.SUCCESS);
 }