コード例 #1
0
 private void EntityAdded(IGameEntity entity)
 {
     try
     {
         MyEntityMap.Add(entity.EntityKey, entity);
         cacheGroup.OnEntityAdded(entity);
     }
     catch (Exception e)
     {
         logger.ErrorFormat("error {0}", e);
     }
 }
コード例 #2
0
 private void EntityDestroy(IGameEntity entity)
 {
     try
     {
         MyEntityMap.Remove(entity.EntityKey);
         cacheGroup.OnEntityRemoved(entity.EntityKey);
     }
     catch (Exception e)
     {
         logger.ErrorFormat("error {0}", e);
     }
 }
コード例 #3
0
        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;
        }