public void ReplaceGameSetup(Assets.Scripts.GameSetup newValue) { var index = GameComponentsLookup.GameSetup; var component = (GameSetupComponent)CreateComponent(index, typeof(GameSetupComponent)); component.value = newValue; ReplaceComponent(index, component); }
public GameEntity SetGameSetup(Assets.Scripts.GameSetup newValue) { if (hasGameSetup) { throw new Entitas.EntitasException("Could not set GameSetup!\n" + this + " already has an entity with GameSetupComponent!", "You should check if the context already has a gameSetupEntity before setting it or use context.ReplaceGameSetup()."); } var entity = CreateEntity(); entity.AddGameSetup(newValue); return(entity); }
public void ReplaceGameSetup(Assets.Scripts.GameSetup newValue) { var entity = gameSetupEntity; if (entity == null) { entity = SetGameSetup(newValue); } else { entity.ReplaceGameSetup(newValue); } }