public RuntimeTerraEntity CreateEntity(ITerraEntityType entityType)
        {
            TerraEntity     newEntity = new TerraEntity();
            AssembledEntity assembled = new AssembledEntity(newEntity);

            newEntity.EntityID = entityType.EntityID;
            _db.Write(newEntity, TerraEntity.Serializer, TerraEntity.WherePrimaryKey);
            RuntimeTerraEntity runtimeTerraEntity = new RuntimeTerraEntity(assembled, _db);

            return(runtimeTerraEntity);
        }
Esempio n. 2
0
        public bool RemoveEntity(TerraEntity entity)
        {
            if (!_entities.Contains(entity))
            {
                return(false);
            }
            else
            {
                _entities.Remove(entity);
                OnRemoveEntity?.Invoke(entity);
            }

            return(true);
        }
Esempio n. 3
0
        public bool AddEntity(TerraEntity entity)
        {
            if (_entities.Contains(entity))
            {
                return(false);
            }
            else
            {
                _entities.Add(entity);
                OnAddEntity?.Invoke(entity);
            }

            return(true);
        }