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; } }
public void Stop(GTime time) { foreach (var i in _elements) { GObject.Destory(i.Value); } this.Tick(time); Enable = false; }
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."); } }
public void Start(GTime time) { Enable = true; this.Tick(time); }
public abstract GAction GetAction(GTime time, GObject current);
public abstract void Execute(GTime time, GObject current);
public override void Execute(GTime time, GObject current) { return; }