Backend (services/): make the app testable and fill real gaps. - Extract buildApp() factory; index.ts owns listen()/matcher tick - Real Apple/Google identity verification via jose JWKS (iss/aud/sub) - Guest -> OAuth account linking (POST /auth/link), rebind in place - POST /matches/:id/complete: record match + participants, update leaderboard, idempotent, guarded by server-to-server secret - Extract pure matchmaking pairing (computePairings); fix ticket deckId loss on match; map ZodError -> 400; @fastify/cors - vitest suite (40 tests), initial Prisma migration, prisma schema path Web (web/): new Vite + React + TS client. - Typed API client with one-shot 401 refresh/retry, localStorage auth - Login (guest), deck builder (slot-0 hero rule), queue polling, leaderboard; 11 tests, clean build Game (Assets/, Unity C#): champion-select layout now fits the roster size; add Golem and Bandit champions. Docs: root DEVELOPMENT.md tying game + services + web together. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
862 B
C#
31 lines
862 B
C#
using UnityEngine;
|
|
|
|
namespace Siegebreak.Hero
|
|
{
|
|
/// <summary>
|
|
/// One cooldown-gated ability per hero. Cooldown state is mirrored
|
|
/// server-side; the client copy here is predictive only, same pattern
|
|
/// as ElixirManager.
|
|
/// </summary>
|
|
public class HeroAbility : MonoBehaviour
|
|
{
|
|
[SerializeField] private float cooldownSeconds = 8f;
|
|
private float _cooldownRemaining;
|
|
|
|
public bool IsReady => _cooldownRemaining <= 0f;
|
|
|
|
public void Tick(float deltaTime)
|
|
{
|
|
if (_cooldownRemaining > 0f) _cooldownRemaining -= deltaTime;
|
|
}
|
|
|
|
public bool TryActivate()
|
|
{
|
|
if (!IsReady) return false;
|
|
_cooldownRemaining = cooldownSeconds;
|
|
// TODO: send ability-use RPC to server; server resolves effect.
|
|
return true;
|
|
}
|
|
}
|
|
}
|