public void ReplaceGameRoot(ChessKnight.Unity.GameRootScript newValue) { var index = GameComponentsLookup.GameRoot; var component = CreateComponent <ChessKnight.Unity.GameRootComponent>(index); component.Value = newValue; ReplaceComponent(index, component); }
public GameEntity SetGameRoot(ChessKnight.Unity.GameRootScript newValue) { if (hasGameRoot) { throw new Entitas.EntitasException("Could not set GameRoot!\n" + this + " already has an entity with ChessKnight.Unity.GameRootComponent!", "You should check if the context already has a gameRootEntity before setting it or use context.ReplaceGameRoot()."); } var entity = CreateEntity(); entity.AddGameRoot(newValue); return(entity); }
public void ReplaceGameRoot(ChessKnight.Unity.GameRootScript newValue) { var entity = gameRootEntity; if (entity == null) { entity = SetGameRoot(newValue); } else { entity.ReplaceGameRoot(newValue); } }