public void ReplaceGameState(_1010C.Scripts.Components.GameState newValue) { var index = GameComponentsLookup.GameState; var component = (_1010C.Scripts.Components.GameStateComponent)CreateComponent(index, typeof(_1010C.Scripts.Components.GameStateComponent)); component.Value = newValue; ReplaceComponent(index, component); }
public GameEntity SetGameState(_1010C.Scripts.Components.GameState newValue) { if (hasGameState) { throw new Entitas.EntitasException("Could not set GameState!\n" + this + " already has an entity with _1010C.Scripts.Components.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(_1010C.Scripts.Components.GameState newValue) { var entity = gameStateEntity; if (entity == null) { entity = SetGameState(newValue); } else { entity.ReplaceGameState(newValue); } }