private void Match3_OnWin(object sender, System.EventArgs e)
 {
     GameSimManager.Instance.SetCounter(levelSO.name + "_Win_MovesUsed", match3.GetUsedMoveCount());
     EndGameSimulation();
 }
Beispiel #2
0
    private void Match3_OnWin(object sender, System.EventArgs e)
    {
        winLoseTransform.gameObject.SetActive(true);
        winLoseTransform.Find("Text").GetComponent <TextMeshProUGUI>().text = "<color=#1ACC23>YOU WIN!</color>";

        LevelProgression.LevelStars levelStars = LevelProgression.LevelStars._1;

        LevelNumberSO levelNumberSO = match3.GetLevelNumberSO();
        LevelSO       levelSO       = match3.GetLevelSO();

        Debug.Log("GetUsedMoveCount:  " + match3.GetUsedMoveCount());
        switch (levelSO.goalType)
        {
        case LevelSO.GoalType.Score:
            if (match3.GetUsedMoveCount() <= levelSO.stars3Goal)
            {
                levelStars = LevelProgression.LevelStars._3;
            }
            else
            {
                if (match3.GetUsedMoveCount() <= levelSO.stars2Goal)
                {
                    levelStars = LevelProgression.LevelStars._2;
                }
            }
            break;

        case LevelSO.GoalType.Glass:
            if (match3.GetUsedMoveCount() <= levelSO.stars3Goal)
            {
                levelStars = LevelProgression.LevelStars._3;
            }
            else
            {
                if (match3.GetUsedMoveCount() <= levelSO.stars2Goal)
                {
                    levelStars = LevelProgression.LevelStars._2;
                }
            }
            break;
        }

        winLoseTransform.Find("Star_1").GetComponent <Image>().color = starUnachievedColor;
        winLoseTransform.Find("Star_2").GetComponent <Image>().color = starUnachievedColor;
        winLoseTransform.Find("Star_3").GetComponent <Image>().color = starUnachievedColor;

        switch (levelStars)
        {
        case LevelProgression.LevelStars._0:
            winLoseTransform.Find("Star_1").gameObject.SetActive(false);
            winLoseTransform.Find("Star_2").gameObject.SetActive(false);
            winLoseTransform.Find("Star_3").gameObject.SetActive(false);
            break;

        case LevelProgression.LevelStars._1:
            winLoseTransform.Find("Star_1").GetComponent <Image>().color = starAchievedColor;
            break;

        case LevelProgression.LevelStars._2:
            winLoseTransform.Find("Star_1").GetComponent <Image>().color = starAchievedColor;
            winLoseTransform.Find("Star_2").GetComponent <Image>().color = starAchievedColor;
            break;

        case LevelProgression.LevelStars._3:
            winLoseTransform.Find("Star_1").GetComponent <Image>().color = starAchievedColor;
            winLoseTransform.Find("Star_2").GetComponent <Image>().color = starAchievedColor;
            winLoseTransform.Find("Star_3").GetComponent <Image>().color = starAchievedColor;
            break;
        }

        LevelProgression.SetLevelStars(match3.GetLevelNumberSO(), levelStars);
    }