public void ReplaceGameState(SemoGames.GameState.GameStates newValue) { var index = GameComponentsLookup.GameState; var component = (SemoGames.GameState.GameStateComponent)CreateComponent(index, typeof(SemoGames.GameState.GameStateComponent)); component.Value = newValue; ReplaceComponent(index, component); }
public GameEntity SetGameState(SemoGames.GameState.GameStates newValue) { if (hasGameState) { throw new Entitas.EntitasException("Could not set GameState!\n" + this + " already has an entity with SemoGames.GameState.GameStateComponent!", "You should check if the context already has a gameStateEntity before setting it or use context.ReplaceGameState()."); } var entity = CreateEntity(); entity.AddGameState(newValue); return(entity); }
public void ReplaceGameState(SemoGames.GameState.GameStates newValue) { var entity = gameStateEntity; if (entity == null) { entity = SetGameState(newValue); } else { entity.ReplaceGameState(newValue); } }