Esempio n. 1
0
    public override void OnDestroy()
    {
        base.OnDestroy();

        missionViews      = null;
        completedRuleInfo = null;
    }
Esempio n. 2
0
    public override void Start()
    {
        base.Start();

        ValidateInfomation();
        currentLevel = PlayerPrefs.GetInt(Literals.LatestLevel);

        var sb = new StringBuilder();

        sb.AppendFormat(Literals.Level0, currentLevel);
        levelText = sb.ToString();

        sceneLoader       = GameObject.Find(Literals.SceneLoader).GetComponent <SceneLoader>();
        completedRuleInfo = new CompletedRuleInfo {
            onMovesComsumed = () => {
                OnPhaseNext();
            },
            onShowGotoNext = () => {
                firework.Play();
                MatchSound.Instance.Play("Win");
                MatchSound.Instance.Play("Firework", .59f);
                Invoke("GoToNext", 2f);
            }
        };

        colorByGemType = new Dictionary <int, Color32>()
        {
            { 10, new Color32(191, 0, 9, 255) },
            { 20, new Color32(0, 71, 172, 255) },
            { 30, new Color32(61, 171, 0, 255) },
            { 40, new Color32(168, 49, 185, 255) },
            { 50, new Color32(249, 160, 16, 255) },
            { 60, new Color32(243, 217, 16, 255) },
        };
    }
Esempio n. 3
0
    public override void OnDestroy()
    {
        base.OnDestroy();

        UnsubscribeInput();

        gemViews          = null;
        actionQueueByTurn = null;
        if (sequence != null)
        {
            sequence.Kill();
            sequence = null;
        }
        completedRuleInfo = null;
    }
Esempio n. 4
0
    IEnumerator WatchPhase()
    {
        if (isPlayingBefore != isPlaying)
        {
            if (isPlayingBefore == false && isPlaying == true && Controller.HasAnyChange())
            {
                OnPhaseNext.Invoke();
            }

            if (isPlayingBefore == true && isPlaying == false && completedRuleInfo != null)
            {
                yield return(null);

                if (completedRuleInfo.ruleModel != null)
                {
                    var latestCount = SetAnyTypeAsSpecial(
                        -1,
                        new string[] { Literals.H, Literals.V, Literals.C },
                        completedRuleInfo.ruleModel.movesLeft,
                        completedRuleInfo.onMovesComsumed
                        ).latestCount;

                    SpecialTypeBreaking(-1, true, latestCount);
                    UpdateChanges();
                    completedRuleInfo.ruleModel       = null;
                    completedRuleInfo.onMovesComsumed = null;
                }
                else if (Controller.HasAnySpecialGems())
                {
                    SpecialTypeBreaking(-1, true);
                    UpdateChanges();
                }
                else if (completedRuleInfo.onShowGotoNext != null)
                {
                    completedRuleInfo.onShowGotoNext();
                    completedRuleInfo = null;
                }
            }
        }
        isPlayingBefore = isPlaying;
        yield return(null);
    }
Esempio n. 5
0
 public void OnAllMissionAchieved(CompletedRuleInfo completedRuleInfo)
 {
     this.completedRuleInfo = completedRuleInfo;
 }