Example #1
0
        public Entity AddTileTemplates(Assets.TemplateNames newValue)
        {
            var componentPool = GetComponentPool(GameComponentIds.TileTemplates);
            var component     = (Assets.TileTemplates)(componentPool.Count > 0 ? componentPool.Pop() : new Assets.TileTemplates());

            component.Value = newValue;
            return(AddComponent(GameComponentIds.TileTemplates, component));
        }
Example #2
0
        public Entity SetTileTemplates(Assets.TemplateNames newValue)
        {
            if (hasTileTemplates)
            {
                throw new EntitasException("Could not set tileTemplates!\n" + this + " already has an entity with Assets.TileTemplates!",
                                           "You should check if the pool already has a tileTemplatesEntity before setting it or use pool.ReplaceTileTemplates().");
            }
            var entity = CreateEntity();

            entity.AddTileTemplates(newValue);
            return(entity);
        }
Example #3
0
        public Entity ReplaceTileTemplates(Assets.TemplateNames newValue)
        {
            var entity = tileTemplatesEntity;

            if (entity == null)
            {
                entity = SetTileTemplates(newValue);
            }
            else
            {
                entity.ReplaceTileTemplates(newValue);
            }

            return(entity);
        }