IEnumerator Decorate()
        {
            // * get times
            SaveBlobV2 blob = SaveManager.FetchBlob();

            int[] times        = blob.NormalTimes;
            int[] collectibles = blob.NormalCollectibles;
            yield return(null);

            // * decorate UI under doors

            for (int i = 0; i < times.Length; i++)
            {
                if (times[i] != -1)
                {
                    uIDecoration.DecorateDoor(i, times[i], collectibles[i]);
                }
                else
                {
                    uIDecoration.RemoveDecoration(i);
                }
            }

            // * decorate doors
            bool first       = true;
            bool allFinished = true;

            for (int i = 0; i < Constants.CHECKPOINT_COUNT; i++)
            {
                HubDoor decorator = transform.GetChild(0).GetChild(i).GetComponent <HubDoor>();
                if (times[i] == -1 && first)
                {
                    decorator.accessible = true;
                    decorator.finished   = false;
                    first       = false;
                    allFinished = false;
                }
                else if (times[i] == -1)
                {
                    decorator.accessible = false;
                    allFinished          = false;
                }
                else
                {
                    decorator.accessible = true;
                    decorator.finished   = true;
                }
                decorator.time = times[i];
                decorator.Init();
            }
            // * enable door to mansion of madness if all other are finished
            // allFinished = true;
            if (allFinished)
            {
                Teleporter madnessTeleporter = transform.GetChild(0).GetChild(Constants.CHECKPOINT_COUNT).GetComponent <Teleporter>();
                madnessTeleporter.accessible = true;
                madnessTeleporter.Init();
            }

            times        = blob.MadnessTimes;
            collectibles = blob.MadnessCollectibles;

            for (int i = 0; i < times.Length; i++)
            {
                if (times[i] != -1)
                {
                    uIDecoration.DecorateDoor(Constants.CHECKPOINT_COUNT + i, times[i], collectibles[i]);
                }
                else
                {
                    uIDecoration.RemoveDecoration(Constants.CHECKPOINT_COUNT + i);
                }
            }

            for (int i = 0; i < Constants.MADNESS_LEVEL_COUNT; i++)
            {
                HubDoor decorator = transform.GetChild(0).GetChild(Constants.CHECKPOINT_COUNT + i + 1).GetComponent <HubDoor>();
                if (times[i] != -1)
                {
                    decorator.finished = true;
                }
                decorator.accessible = true;
                decorator.time       = times[i];
                decorator.Init();
            }



            // * disable hud features that are not needed in HUB world
            HudScript.hud.EnterHub();
        }
Exemple #2
0
 public void SetTeleporter(Teleporter teleporter)
 {
     this.teleporter = teleporter;
 }