void Start()
    {
        List <string> allPages = new List <string>();

        allPages.AddRange(this.IntroPages);
        int[] bosses = ProgressData.GetCurrentBosses();

        if (this.UseBossText)
        {
            foreach (int bossId in bosses)
            {
                BossType bossType = StaticData.BossData.BossTypes[bossId];
                allPages.Add(bossType.PageText1);
                if (!this.LimitOnePagePerBoss)
                {
                    allPages.Add(bossType.PageText2);
                }
            }
        }

        allPages.AddRange(this.OutroPages);

        foreach (string page in allPages)
        {
            this.PageHandler.AddPage(page);
        }

        _avatarKeys = new string[allPages.Count];

        if (this.UseBossText)
        {
            for (int i = this.IntroPages.Count; i < allPages.Count - this.OutroPages.Count; ++i)
            {
                int      bossId   = bosses[i - this.IntroPages.Count];
                BossType bossType = StaticData.BossData.BossTypes[bossId];
                _avatarKeys[i] = bossType.SceneKey;
                if (!this.LimitOnePagePerBoss)
                {
                    ++i;
                }
            }
        }

        if (this.UseChoices)
        {
            GlobalEvents.Notifier.Listen(MenuElementSelectedEvent.NAME, this, choiceMade);
        }

        this.PageHandler.OnFlippedLastPage = flippedLastPage;
        _timedCallbacks.AddCallback(this, beginPageFlipping, this.IntroDelay);
    }
Exemple #2
0
    void Update()
    {
        if (!this.AcceptingInput || PauseController.IsPaused())
        {
            return;
        }

        if (MenuInput.AnyInput())
        {
            IntegerVector newPosition = this.CurrentPosition;

            if (this.CurrentPosition.X > -_halfSize && MenuInput.NavLeft())
            {
                newPosition.X -= 1;
            }
            else if (this.CurrentPosition.Y > -_halfSize && MenuInput.NavDown())
            {
                newPosition.Y -= 1;
            }
            else if (this.CurrentPosition.X < _halfSize && MenuInput.NavRight())
            {
                newPosition.X += 1;
            }
            else if (this.CurrentPosition.Y < _halfSize && MenuInput.NavUp())
            {
                newPosition.Y += 1;
            }

            if ((newPosition.X != this.CurrentPosition.X || newPosition.Y != this.CurrentPosition.Y) && _grid[newPosition.X + _halfSize, newPosition.Y + _halfSize] != null)
            {
                moveCurrentTile(newPosition);
            }
            else if (MenuInput.SelectCurrentElement() && _grid[this.CurrentPosition.X + _halfSize, this.CurrentPosition.Y + _halfSize].State == TileState.Available)
            {
                int bossIndex = -1;
                for (int i = 0; i < this.BossTiles.Length; ++i)
                {
                    IntegerVector tile = this.BossTiles[i];

                    if (this.CurrentPosition.X == tile.X && this.CurrentPosition.Y == tile.Y)
                    {
                        bossIndex = i;
                        break;
                    }
                }

                //TODO - Send input to level generation
                ProgressData.SelectTile(this.CurrentPosition);
                if (_allBossesDefeated && this.CurrentPosition.X == 0 && this.CurrentPosition.Y == 0)
                {
                    SceneManager.LoadScene(this.FinalDialogSceneName);
                }
                else if (bossIndex == -1)
                {
                    SceneManager.LoadScene(this.GameplaySceneName);
                }
                else
                {
                    BossType boss = StaticData.BossData.BossTypes[ProgressData.GetCurrentBosses()[bossIndex]];
                    SceneManager.LoadScene(this.BossSceneName + boss.SceneKey);
                }
            }
        }

        else
        {
            if (!_currentBlinkingOff && _timeSinceBlink >= this.BlinkIntervalOn)
            {
                blinkCurrentTileOff();
            }
            else if (_currentBlinkingOff && _timeSinceBlink >= this.BlinkIntervalOff)
            {
                blinkCurrentTileOn();
            }
            else
            {
                _timeSinceBlink += Time.deltaTime;
            }
        }
    }