public void ReplaceGameConfiguration(Configuration.IGameConfiguration newValue) { var index = ConfigurationComponentsLookup.GameConfiguration; var component = (GameConfigurationComponent)CreateComponent(index, typeof(GameConfigurationComponent)); component.value = newValue; ReplaceComponent(index, component); }
public ConfigurationEntity SetGameConfiguration(Configuration.IGameConfiguration newValue) { if (hasGameConfiguration) { throw new Entitas.EntitasException("Could not set GameConfiguration!\n" + this + " already has an entity with GameConfigurationComponent!", "You should check if the context already has a gameConfigurationEntity before setting it or use context.ReplaceGameConfiguration()."); } var entity = CreateEntity(); entity.AddGameConfiguration(newValue); return(entity); }
public void ReplaceGameConfiguration(Configuration.IGameConfiguration newValue) { var entity = gameConfigurationEntity; if (entity == null) { entity = SetGameConfiguration(newValue); } else { entity.ReplaceGameConfiguration(newValue); } }