예제 #1
0
    public void SetQuest(ActiveQuestBase currentQuest)
    {
        RemoveListeners(previous);

        if (currentQuest is ActiveWalkingQuest)
        {
            ActiveWalkingQuest awq = currentQuest as ActiveWalkingQuest;
            awq.AmountSoFar.OnChange.AddListener(OnChange);
        }
        else if (currentQuest is ActiveQuest <int, IntVariable, UnityEventInt> )
        {
            ActiveQuest <int, IntVariable, UnityEventInt> awq = currentQuest as ActiveQuest <int, IntVariable, UnityEventInt>;
            awq.AmountSoFar.OnChange.AddListener(OnChange);
        }
        else if (currentQuest is ReachValueQuest)
        {
            var awq = currentQuest as ReachValueQuest;
            awq.TotalAmount.OnChange.AddListener(OnChange);
        }

        var prog = currentQuest.GetProgress();

        ProgressText.text = $"{prog.current} / {prog.max}";
        ProgressFill.rectTransform.anchorMax =
            ProgressFill.rectTransform.anchorMax.SetX(Mathf.Clamp01((float)(prog.current / prog.max)));
        QuestTitle.text = currentQuest.DisplayName;
        previous        = currentQuest;
    }
예제 #2
0
    void OnChange(int val)
    {
        if (prevVal != -1 && val > prevVal)
        {
            SmoothPopUpManager.ShowPopUp(SpawnPointOfNumberIncreasePopUp.position, "+" + (val - prevVal), Color.green, true);
        }
        prevVal = val;
        var prog = previous.GetProgress();

        ProgressText.text = $"{prog.current} / {prog.max}";
        ProgressFill.rectTransform.anchorMax =
            ProgressFill.rectTransform.anchorMax.SetX(Mathf.Clamp01((float)(prog.current / prog.max)));
    }