public void GenerateText(string text, Vector3 otherPos) { GameObject newTransform = CloseCallTxtPooler.GetPooledObject(); PopupText popup = newTransform.GetComponentInChildren <PopupText>(); popup.SetText(text); /*switch (num) * { * case 1: * popup.SetColor(new Color(250, 197, 28)); * break; * case 2: * popup.SetColor(new Color(251, 160, 38)); * break; * case 3: * popup.SetColor(new Color(243, 121, 52)); * break; * }*/ newTransform.transform.SetParent(aux.inGameCanvas.transform, false); /*Vector2 canvasPos; * Vector3 newPos = cam.WorldToScreenPoint(otherTransform.position); * RectTransformUtility.ScreenPointToLocalPointInRectangle(inGameCanvas.GetComponent<RectTransform>(), newPos, null, out canvasPos);*/ newTransform.transform.position = aux.WorldToUISpace(aux.inGameCanvas, otherPos); newTransform.transform.rotation = Quaternion.identity; newTransform.gameObject.SetActive(true); }
IEnumerator AirSpringTimer(float seconds) { airPowerTimerSlider.gameObject.SetActive(true); float animationTime = 0f; while (animationTime < seconds) { Vector3 topOfPlayer = new Vector3(transform.position.x, transform.position.y + 1f); airPowerTimerSlider.gameObject.transform.position = aux.WorldToUISpace(aux.inGameCanvas, topOfPlayer); animationTime += Time.deltaTime; float lerpValue = animationTime / seconds; airPowerTimerSlider.value = Mathf.Lerp(100f, 0f, lerpValue); yield return(null); } airPowerTimerSlider.gameObject.SetActive(false); PM.SetPlayerState(States.STATE_NORMAL); PM.playerHooks = Hooks.HOOK_ROPE; DestroySpring(); //comboCount = 0; //DeathMenu(); }