private void DeleteEntity(Entity.SerializableEntity serializableEntity) { var map = campaign.activeMap; var entity = map.entities.FirstOrDefault(x => x.id == serializableEntity.id); if (entity == null) { return; } map.entities.Remove(entity); map.selectedEntities.Remove(entity); Destroy(entity.gameObject); }
private void ChangeEntity(Entity.SerializableEntity serializableEntity) { var map = campaign.activeMap; var entity = map.entities.FirstOrDefault(x => x.id == serializableEntity.id); if (entity == null) { entity = Instantiate(entityPrefab, map.entitiesParent).GetComponent <Entity>(); entity.map = map; map.entities.Add(entity); } entity.Deserialize(serializableEntity); foreach (var e in map.entities.Where(x => x.SharedVision)) { e.ResetVision(); } }