Ejemplo n.º 1
0
        // -----------------------------------------------------------------------------------
        protected override void Award()
        {
            Data.UnlockState unlockState = Data.SaveFile.instance.unlockState;
            Vector3          pos         = playArea.MaskPositionToWorld(x, y);

            // play effects (awards in controller)
            if (unlockState[letter])
            {
                playArea.effects.ShowScore(Config.instance.unlockLetterScore, pos);
            }

            else
            {
                switch (letter)
                {
                case UNLOCK.U: UI.instance.PlayBonusItemEffect(BonusEffect.Type.Letter_U, pos); break;

                case UNLOCK.N: UI.instance.PlayBonusItemEffect(BonusEffect.Type.Letter_N, pos); break;

                case UNLOCK.L: UI.instance.PlayBonusItemEffect(BonusEffect.Type.Letter_L, pos); break;

                case UNLOCK.O: UI.instance.PlayBonusItemEffect(BonusEffect.Type.Letter_O, pos); break;

                case UNLOCK.C: UI.instance.PlayBonusItemEffect(BonusEffect.Type.Letter_C, pos); break;

                case UNLOCK.K: UI.instance.PlayBonusItemEffect(BonusEffect.Type.Letter_K, pos); break;
                }
            }

            Destroy(gameObject);
        }
Ejemplo n.º 2
0
        // -----------------------------------------------------------------------------------
        /// <summary>
        /// Asks if you want to unlock the image
        /// </summary>
        /// <param name="round"></param>
        /// <returns></returns>
        IEnumerator AskToUnlock(int round)
        {
            Data.UnlockState unlockState = Data.SaveFile.instance.unlockState;

            string msg = string.Format("Do you want to unlock this image?");

            yield return(StartCoroutine(PopupManager.instance.ShowMessagePopup(msg.ToUpper(), "UNLOCK IMAGE?", MessagePopup.Type.UnlockYesNo)));

            if (PopupManager.instance.button == PopupManager.Button.Yes)
            {
                unlockState.Clear();
                stats.rounds[round].cleared = true;
                icons[round].AnimateUnlock(characterFile.baseSheet.roundIcons[round]);
                Data.SaveFile.instance.Save();
            }
        }
Ejemplo n.º 3
0
        // --- Methods ----------------------------------------------------------------------------------
        // -----------------------------------------------------------------------------------
        private void OnRoundSelected(int round)
        {
            if (characterFile == null)
            {
                SoundManager.instance.PlaySFX("ui_cancel");
                string msg = string.Format("Select a non-random character");
                StartCoroutine(PopupManager.instance.ShowMessagePopup(msg.ToUpper(), "UNAVAILABLE"));
                return;
            }

            if (stats.rounds[round].cleared)
            {
                RoundImageViewer.instance.Show(characterFile, round);
            }
            else if (round < characterFile.availableRounds)
            {
                SoundManager.instance.PlaySFX("ui_cancel");

                Data.UnlockState unlockState = Data.SaveFile.instance.unlockState;
                if (unlockState.allCollected)
                {
                    // the previous round must also be unlocked
                    if (round == 0 || stats.rounds[round - 1].cleared)
                    {
                        StartCoroutine(AskToUnlock(round));
                    }
                    else
                    {
                        string msg = "Unlock the previous image first!";
                        StartCoroutine(PopupManager.instance.ShowMessagePopup(msg.ToUpper(), "IMAGE LOCKED", MessagePopup.Type.UnlockOk));
                    }
                }
                else
                {
                    string diff = round == Config.Rounds - 1 ? "hard" : "normal";
                    string msg  = string.Format("Clear round {0} in {1} difficulty,\nor collect all 6 letters to unlock", round + 1, diff);
                    StartCoroutine(PopupManager.instance.ShowMessagePopup(msg.ToUpper(), "IMAGE LOCKED", MessagePopup.Type.UnlockOk));
                }
            }
            else
            {
                SoundManager.instance.PlaySFX("ui_cancel");
                string msg = string.Format("Character does not have round {0}", round + 1);
                StartCoroutine(PopupManager.instance.ShowMessagePopup(msg.ToUpper(), "UNAVAILABLE"));
            }
        }
Ejemplo n.º 4
0
        // -----------------------------------------------------------------------------------
        private void OnBonusAwarded(BonusItem item)
        {
            // Let's do the correct thing according to item type
            System.Type type = item.GetType();

            if (type == typeof(ExtraLifeItem))
            {
                livesLeft++;
                UI.instance.lives = livesLeft;
            }

            else if (type == typeof(SkillRechargeItem))
            {
                Skill.instance.FullRecharge();
            }

            else if (type == typeof(ExtraTimeItem))
            {
                Timer.instance.ExtendTimer((item as ExtraTimeItem).time);
            }

            else if (type == typeof(UnlockLetterItem))
            {
                UnlockLetterItem letterItem  = item as UnlockLetterItem;
                Data.UnlockState unlockState = Data.SaveFile.instance.unlockState;

                // already unlocked: award points
                if (unlockState[letterItem.letter])
                {
                    score += Config.instance.unlockLetterScore;
                    UI.instance.scoreDisplay.score = (long)score;
                }

                // unlock letters
                else
                {
                    UI.instance.unlockLetters.ShowLetter(letterItem.letter, true);
                    unlockState[letterItem.letter] = true;
                    Data.SaveFile.instance.Save();
                }
            }
        }