public void ReplaceEndGameBehaviour(EndGameBehaviour newValue) { var index = GameComponentsLookup.EndGameBehaviour; var component = CreateComponent <EndGameBehaviourComponent>(index); component.value = newValue; ReplaceComponent(index, component); }
public GameEntity SetEndGameBehaviour(EndGameBehaviour newValue) { if (hasEndGameBehaviour) { throw new Entitas.EntitasException("Could not set EndGameBehaviour!\n" + this + " already has an entity with EndGameBehaviourComponent!", "You should check if the context already has a endGameBehaviourEntity before setting it or use context.ReplaceEndGameBehaviour()."); } var entity = CreateEntity(); entity.AddEndGameBehaviour(newValue); return(entity); }
public void ReplaceEndGameBehaviour(EndGameBehaviour newValue) { var entity = endGameBehaviourEntity; if (entity == null) { entity = SetEndGameBehaviour(newValue); } else { entity.ReplaceEndGameBehaviour(newValue); } }