public void ReplaceShotSettings(Game.Settings.ShotSettings newValue) { var index = GameComponentsLookup.ShotSettings; var component = CreateComponent <ShotSettingsComponent>(index); component.value = newValue; ReplaceComponent(index, component); }
public GameEntity SetShotSettings(Game.Settings.ShotSettings newValue) { if (hasShotSettings) { throw new Entitas.EntitasException("Could not set ShotSettings!\n" + this + " already has an entity with ShotSettingsComponent!", "You should check if the context already has a shotSettingsEntity before setting it or use context.ReplaceShotSettings()."); } var entity = CreateEntity(); entity.AddShotSettings(newValue); return(entity); }
public void ReplaceShotSettings(Game.Settings.ShotSettings newValue) { var entity = shotSettingsEntity; if (entity == null) { entity = SetShotSettings(newValue); } else { entity.ReplaceShotSettings(newValue); } }