private void EntityAdded(IGameEntity entity) { try { MyEntityMap.Add(entity.EntityKey, entity); cacheGroup.OnEntityAdded(entity); } catch (Exception e) { logger.ErrorFormat("error {0}", e); } }
private void AddEntities(IGameContext basicInfo) { var entities = basicInfo.GetEntities(); foreach (var entity in entities) { MyEntityMap.Add(entity.EntityKey, entity); } basicInfo.EntityAdded += EntityAdded; basicInfo.EntityRemoved += EntityDestroy; basicInfo.EntityComponentChanged += EntityComponentChanged; }