Esempio n. 1
0
        private void Tick(GTime time)
        {
            if (!Enable)
            {
                return;
            }
            var current = _elementList.First;

            while (current != null)
            {
                var next = current.Next;
                if (current.Value.Enable)
                {
                    current.Value.Controllor.GetAction(time, current.Value)
                    .Execute(time, current.Value);
                }
                if (!current.Value.Enable && current.Value.CanDestory)
                {
                    _elements.Remove(current.Value.Index);
                    GObject.ExitState(current.Value);
                    _elementList.Remove(current);
                }
                current = next;
            }
        }
Esempio n. 2
0
 public void Stop(GTime time)
 {
     foreach (var i in _elements)
     {
         GObject.Destory(i.Value);
     }
     this.Tick(time);
     Enable = false;
 }
Esempio n. 3
0
 public static void Tick(GState state, GTime now)
 {
     if (state.Enable)
     {
         state.Tick(now);
     }
     else
     {
         throw new Exception("You can't tick a state before you start it.");
     }
 }
Esempio n. 4
0
 public void Start(GTime time)
 {
     Enable = true;
     this.Tick(time);
 }
Esempio n. 5
0
 public abstract GAction GetAction(GTime time, GObject current);
Esempio n. 6
0
 public abstract void Execute(GTime time, GObject current);
Esempio n. 7
0
 public override void Execute(GTime time, GObject current)
 {
     return;
 }