Exemplo n.º 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);
        }
Exemplo n.º 2
0
        private void Start()
        {
            inputField = GetComponent <InputField>();
            saveMenu   = GetComponentInParent <SaveMenu>();

            eventsCentre = EventsCentre.GetInstance();
        }
Exemplo n.º 3
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.layer == (int)Layer.Room)
     {
         Vector3 newPosition = roomDetector.GetCurrentRoomPosition();
         EventsCentre.GetInstance().Publish(new RoomChangeEvent(newPosition));
     }
 }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
 private void Start()
 {
     eventsCentre   = EventsCentre.GetInstance();
     spriteRenderer = GetComponent <SpriteRenderer>();
 }
Exemplo n.º 6
0
 public void Start()
 {
     eventsCentre = EventsCentre.GetInstance();
 }
Exemplo n.º 7
0
 private void Awake()
 {
     eventsCentre = EventsCentre.GetInstance();
     eventsCentre.Subscribe(new Topic("RoomChange"), this);
 }
Exemplo n.º 8
0
 private void Awake()
 {
     eventsCentre = EventsCentre.GetInstance();
     eventsCentre.Subscribe(new Topic("RoomChange"), this);
     playerGameObject = GameObject.FindWithTag(Tags.Player);
 }