using CommonLang; using CommonLang.Concurrent; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CommonAI.Zone { abstract public class GameEntity : Disposable { private HashMap mAttributes = new HashMap(); public GameEntity() { } public bool IsAttribute(string key) { return mAttributes.ContainsKey(key); } public void SetAttribute(string key, object value) { mAttributes.Put(key, value); } public object RemoveAttribute(string key) { return mAttributes.RemoveByKey(key); } public object GetAttribute(string key) { return mAttributes.Get(key); } public T GetAttributeAs(string key) { object obj = mAttributes.Get(key); if (obj != null) { return (T)obj; } return default(T); } protected override void Disposing() { mAttributes.Clear(); } } }