private void Awake() { DontDestroyOnLoad(gameObject); game = GetComponent <Game>(); level = GetComponent <Level>(); levelFiles = GetComponent <LevelFiles>(); IStorage storage = new StorageFacade(); game.Init(storage); level.Init(storage); levelFiles.Init(storage); eventsCentre = EventsCentre.GetInstance(); eventsCentre.Subscribe(new Topic("GameStart"), this, NewGame); eventsCentre.Subscribe(new Topic("GameRestart"), this, RestartGame); eventsCentre.Subscribe(new Topic("GameExit"), this, ExitGame); eventsCentre.Subscribe(new Topic("LevelSave"), this, SaveLevel); eventsCentre.Subscribe(new Topic("LevelEnd"), this, NextLevel); eventsCentre.Subscribe(new Topic("FileDelete"), this); eventsCentre.Subscribe(new Topic("FileOverride"), this); eventsCentre.Subscribe(new Topic("FileLoad"), this); eventsCentre.Subscribe(new Topic("UnlockedLevelsCountRequest"), this); }
private void Start() { inputField = GetComponent <InputField>(); saveMenu = GetComponentInParent <SaveMenu>(); eventsCentre = EventsCentre.GetInstance(); }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.layer == (int)Layer.Room) { Vector3 newPosition = roomDetector.GetCurrentRoomPosition(); EventsCentre.GetInstance().Publish(new RoomChangeEvent(newPosition)); } }
/// <summary> /// Unlock all the levels that the player has completed /// with the exception of the always-unlocked first level /// </summary> private void Start() { var levelButtons = GetComponentsInChildren <Button>(); eventsCentre = EventsCentre.GetInstance(); unlockedLevelsCount = DefaultUnlockedLevelsCount; eventsCentre.Subscribe(new Topic("UnlockedLevelsCountReply"), this); UnlockLevelButtons(levelButtons); }
private void Start() { eventsCentre = EventsCentre.GetInstance(); spriteRenderer = GetComponent <SpriteRenderer>(); }
public void Start() { eventsCentre = EventsCentre.GetInstance(); }
private void Awake() { eventsCentre = EventsCentre.GetInstance(); eventsCentre.Subscribe(new Topic("RoomChange"), this); }
private void Awake() { eventsCentre = EventsCentre.GetInstance(); eventsCentre.Subscribe(new Topic("RoomChange"), this); playerGameObject = GameObject.FindWithTag(Tags.Player); }