Unity Game SDKv0.5.1Download SDK
RUEN

Example: precision target

A 10-shot series, scoring rings from 1 to 10, one visible marker for the latest hit, and a total score out of 100.

Scene structure

Canvas ├── TargetPlayfield │ ├── Rings │ └── LastHitMarker ├── ScorePanel ├── ShotCounter └── ResultPanel VORIVOX SDK GameController

Hit logic

private void OnHit(VorivoxHit hit)
{
    if (!roundActive || shotCount >= 10)
        return;

    Vector2 point = hit.ToCanvasLocal(playfield);
    float radius = point.magnitude / targetRadius;
    int ring = CalculateRing(radius);

    shotCount++;
    totalScore += ring;
    ShowOnlyLastMarker(point, ring);
    RefreshHud();

    if (shotCount == 10)
        FinishRound();
}

Ring calculation

private static int CalculateRing(float normalizedRadius)
{
    if (normalizedRadius > 1f) return 0;
    return Mathf.Clamp(10 - Mathf.FloorToInt(normalizedRadius * 10f), 1, 10);
}
For a real precision target, store exact ring radii in configuration instead of assuming every ring has the same width.