private IEnumerator Explode() { transform.localScale = Vector3.zero; while (t < 1f) { e = Ease.EaseOutBack(t); transform.localScale = Vector3.LerpUnclamped(Vector3.zero, Vector3.one, e); t += Time.deltaTime * ExplosionSpeed; yield return(null); } StartCoroutine(Shrink()); }
public void SetBombPositionAndTime(Vector3 bombPosition, float time, Bomb bomb, bool hasExploded, bool hasBeenPickedUp) { Vector2 screenPosition = cam.WorldToScreenPoint(bombPosition); float scaleFactor = canvas.scaleFactor; Vector2 scaledPosition = new Vector2( screenPosition.x / scaleFactor, screenPosition.y / scaleFactor); if (hasExploded || hasBeenPickedUp) { textToDisplay = ""; } else { float decimals = time - (int)time; int fontSizeBouncy = 0; if (decimals > delay) { float inverseDecimals = Mathf.InverseLerp(1f, delay, decimals); inverseDecimals = Ease.EaseOutBack(inverseDecimals); if (time < 4) { //bombText[bomb].color = textColor; fontSizeBouncy = (int)Mathf.LerpUnclamped(0, maxFontSize + 80, inverseDecimals); } else { fontSizeBouncy = (int)Mathf.LerpUnclamped(0, maxFontSize, inverseDecimals); } } bombText[bomb].fontSize = fontSizeBouncy; if (time < 1) { textToDisplay = "!"; } else { textToDisplay = ((int)time).ToString(); } } bombText[bomb].text = textToDisplay; bombText[bomb].rectTransform.anchoredPosition = scaledPosition; }