public void ReplaceGameConfig(Features.Config.IGameConfig newValue) { var index = ConfigComponentsLookup.GameConfig; var component = (GameConfigComponent)CreateComponent(index, typeof(GameConfigComponent)); component.value = newValue; ReplaceComponent(index, component); }
public ConfigEntity SetGameConfig(Features.Config.IGameConfig newValue) { if (hasGameConfig) { throw new Entitas.EntitasException("Could not set GameConfig!\n" + this + " already has an entity with GameConfigComponent!", "You should check if the context already has a gameConfigEntity before setting it or use context.ReplaceGameConfig()."); } var entity = CreateEntity(); entity.AddGameConfig(newValue); return(entity); }
public void ReplaceGameConfig(Features.Config.IGameConfig newValue) { var entity = gameConfigEntity; if (entity == null) { entity = SetGameConfig(newValue); } else { entity.ReplaceGameConfig(newValue); } }