public void ReplaceGamePlaySystem(GamePlaySystem newGamePlaySystem) { var index = GameComponentsLookup.GamePlaySystem; var component = (GamePlaySystemComponent)CreateComponent(index, typeof(GamePlaySystemComponent)); component.GamePlaySystem = newGamePlaySystem; ReplaceComponent(index, component); }
public GameEntity SetGamePlaySystem(GamePlaySystem newGamePlaySystem) { if (hasGamePlaySystem) { throw new Entitas.EntitasException("Could not set GamePlaySystem!\n" + this + " already has an entity with GamePlaySystemComponent!", "You should check if the context already has a gamePlaySystemEntity before setting it or use context.ReplaceGamePlaySystem()."); } var entity = CreateEntity(); entity.AddGamePlaySystem(newGamePlaySystem); return(entity); }
public void ReplaceGamePlaySystem(GamePlaySystem newGamePlaySystem) { var entity = gamePlaySystemEntity; if (entity == null) { entity = SetGamePlaySystem(newGamePlaySystem); } else { entity.ReplaceGamePlaySystem(newGamePlaySystem); } }
public void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); return; } spawner = gameObject.GetComponent <CustomerSpawner>(); }