public void CacheBehavior(ECBehavior beh) { beh.ECObj = null; beh.IsValid = true; LinkedList<ECBehavior> cache = m_cache[(int)beh.Type]; if (cache.Count < MaxCacheNum[(int)beh.Type]) cache.AddLast(beh); }
public void AddBehavior(ECBehavior beh) { beh.ECObj = this; LinkedListNode<ECBehavior> pos = m_BehaviorList.First; while (pos != null) { ECBehavior b = pos.Value; if (b.Type == beh.Type) { if(b.IsValid) { b.OnRemoved(true); if (b.OnFinish != null) b.OnFinish(0); } pos.Value = beh; ECBehaviorCache.Instance.CacheBehavior(b); return; } pos = pos.Next; } m_BehaviorList.AddLast(beh); }