Beispiel #1
0
        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);
        }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
 private void Awake()
 {
     eventsCentre = EventsCentre.GetInstance();
     eventsCentre.Subscribe(new Topic("RoomChange"), this);
 }
Beispiel #4
0
 private void Awake()
 {
     eventsCentre = EventsCentre.GetInstance();
     eventsCentre.Subscribe(new Topic("RoomChange"), this);
     playerGameObject = GameObject.FindWithTag(Tags.Player);
 }