Initial commit

This commit is contained in:
rudder
2026-08-12 14:03:44 +03:00
commit 9a7b4a57dc
304 changed files with 82311 additions and 0 deletions
@@ -0,0 +1,43 @@
using System.Collections;
using TMPro;
using UnityEngine;
namespace LiveOpsExamples
{
/// <summary>
/// World-space "+N" score popup. Floats up ~0.5 world units and fades out over
/// 0.7 s (Cubic.easeOut, like the Phaser floatScore tween), then destroys itself.
/// </summary>
public class ScorePopupView : MonoBehaviour
{
private const float FloatDistance = 0.5f;
private const float LifetimeSeconds = 0.7f;
[SerializeField] private TextMeshPro label;
public void Set(int gain)
{
label.text = "+" + gain;
StartCoroutine(Animate());
}
private IEnumerator Animate()
{
var start = transform.position;
var color = label.color;
var elapsed = 0f;
while (elapsed < LifetimeSeconds)
{
elapsed += Time.deltaTime;
var t = Mathf.Clamp01(elapsed / LifetimeSeconds);
var eased = 1f - Mathf.Pow(1f - t, 3f);
transform.position = start + new Vector3(0f, FloatDistance * eased, 0f);
label.color = new Color(color.r, color.g, color.b, color.a * (1f - eased));
yield return null;
}
Destroy(gameObject);
}
}
}