private void Start() { startingSpeed = speed; //set starting speed so when running, we can return back to normal audioSource = GetComponent <AudioSource>(); //get audio component isPlaying = false; //bool used to play audio without constant starting over changeGemWorthText = gemWorthText.GetComponent <FloatingGemWorthText>(); //in future implementations, we can add gems worth different amounts }
public static void Initialize() { canvas = GameObject.Find("Canvas"); if (!popupText) { popupText = Resources.Load <FloatingGemWorthText>("Prefab/GemWorthText_Parent"); } Debug.Log("We loaded: " + popupText); }
public static void CreateWorthText(string text, Transform location) { Debug.Log("text is called"); FloatingGemWorthText instance = Instantiate(popupText); Vector2 screenPosition = Camera.main.WorldToScreenPoint(location.position); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(text); }
public void OnEnable() { popupText = GetComponent <FloatingGemWorthText>(); }