Advertisement
evelynshilosky

QuestRow - Part 29

Jan 5th, 2024
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using TMPro;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6.  
  7. public class QuestRow : MonoBehaviour
  8. {
  9.     public TextMeshProUGUI questName;
  10.     public TextMeshProUGUI questGiver;
  11.    
  12.     public Button trackingButton;
  13.    
  14.     public bool isActive;
  15.     public bool isTracking;
  16.    
  17.     public Text coinAmount;
  18.    
  19.     public Image firstReward;
  20.     public Text firstRewardAmount;
  21.    
  22.     public Image secondReward;
  23.     public Text secondRewardAmount;
  24.  
  25.     public Quest thisQuest;
  26.  
  27.     private void Start()
  28.     {
  29.         trackingButton.onClick.AddListener(() => {
  30.  
  31.             if (isActive)
  32.             {
  33.                 if (isTracking)
  34.                 {
  35.                     isTracking = false;
  36.                     trackingButton.gameObject.GetComponentInChildren<TextMeshProUGUI>().text = "Not Tracking";
  37.                     QuestManager.Instance.UnTrackerQuest(thisQuest);
  38.                 }
  39.                 else
  40.                 {
  41.                     isTracking = true;
  42.                     trackingButton.gameObject.GetComponentInChildren<TextMeshProUGUI>().text = "Tracking";
  43.                     QuestManager.Instance.TrackQuest(thisQuest);
  44.                 }
  45.             }
  46.  
  47.         });
  48.     }
  49.  
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement