public void ReplaceGameMode(Features.Config.GameMode newValue) { var index = GameComponentsLookup.GameMode; var component = (Features.Components.GameModeComponent)CreateComponent(index, typeof(Features.Components.GameModeComponent)); component.Value = newValue; ReplaceComponent(index, component); }
public GameEntity SetGameMode(Features.Config.GameMode newValue) { if (hasGameMode) { throw new Entitas.EntitasException("Could not set GameMode!\n" + this + " already has an entity with Features.Components.GameModeComponent!", "You should check if the context already has a gameModeEntity before setting it or use context.ReplaceGameMode()."); } var entity = CreateEntity(); entity.AddGameMode(newValue); return(entity); }
public void ReplaceGameMode(Features.Config.GameMode newValue) { var entity = gameModeEntity; if (entity == null) { entity = SetGameMode(newValue); } else { entity.ReplaceGameMode(newValue); } }