Пример #1
0
        // PRAGMA MARK - Public Interface
        public DTEntity()
        {
#if UNITY_EDITOR
            // only do this expensive initialization if we're being created in the unity editor
            DTEntityInitializer.Initialize(this.GetType(), this);
#endif
        }
Пример #2
0
        private void CreateMap()
        {
            this._map.Clear();

            foreach (TEntity entity in this._data)
            {
                if (entity == null)
                {
                    continue;
                }

                DTEntityInitializer.Initialize <TEntity>(entity);

                IdComponent idComponent = entity.GetComponent <IdComponent>();
                if (idComponent == null)
                {
                    Debug.LogError("IdList - entity does not have IdComponent!");
                    continue;
                }

                this._map[idComponent.id] = entity;
            }
        }
 // PRAGMA MARK - Static
 public static void Initialize <TEntity>(TEntity entity) where TEntity : DTEntity
 {
     DTEntityInitializer.Initialize(typeof(TEntity), entity);
 }