Merge branch 'feature/draft-system'
This commit is contained in:
commit
b0ca2e1d28
22 changed files with 1060 additions and 430 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections;
|
|||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
using TD.Core;
|
||||
using TD.Gameplay.Draft;
|
||||
using TD.Levels;
|
||||
using TD.UI;
|
||||
|
||||
|
|
@ -318,6 +319,11 @@ namespace TD.Gameplay
|
|||
activeEnemyCount = 0;
|
||||
spawningComplete = false;
|
||||
heldEnemies.Clear();
|
||||
|
||||
// Force-advancing interrupts the prep phase, so resolve any drafts the players
|
||||
// had open before skipping ahead.
|
||||
DraftService.Instance?.ServerAutoResolveAll();
|
||||
|
||||
StartNextWave(skipPrep: true);
|
||||
}
|
||||
|
||||
|
|
@ -330,6 +336,10 @@ namespace TD.Gameplay
|
|||
// observe the value via NetworkVariable replication.
|
||||
if (!skipPrep)
|
||||
{
|
||||
// Open a draft for every player at the start of the build phase. They pick
|
||||
// during prep; any unpicked draft is auto-resolved when the timer expires.
|
||||
DraftService.Instance?.ServerOfferToAll();
|
||||
|
||||
prepCountdown.Value = def.PrepTime;
|
||||
float remaining = def.PrepTime;
|
||||
// Throttle network sync to ~10 Hz. NetworkVariable replicates on every
|
||||
|
|
@ -348,6 +358,10 @@ namespace TD.Gameplay
|
|||
nextSync = remaining - NetworkSyncInterval;
|
||||
}
|
||||
}
|
||||
|
||||
// Prep timer expired — auto-resolve any draft the player didn't pick so
|
||||
// the free reward isn't wasted.
|
||||
DraftService.Instance?.ServerAutoResolveAll();
|
||||
}
|
||||
// Ensure the countdown reads zero entering the spawn phase, regardless of
|
||||
// whether prep was skipped or just expired.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue