cheer fx and post match screen

This commit is contained in:
2026-04-05 09:23:55 +05:30
parent 352693c860
commit 4cabf27f29
21 changed files with 19623 additions and 42 deletions
+44 -10
View File
@@ -108,11 +108,13 @@ public class GameManager : NetworkBehaviour
[SyncVar(hook = nameof(OnScoreChanged))]
public int blueScore=0;
[Header("Effects")]
public ParticleSystem[] redGoalEffects;
public ParticleSystem[] blueGoalEffects;
[Header("UI")]
public TMP_Text redScoreText;
public TMP_Text blueScoreText;
public GameObject gameOverPanel;
public GameObject blueWon,redWon;
public CanvasGroupUtils blueTimerGroup;
[FormerlySerializedAs("timerGroup")] public CanvasGroupUtils redTimerGroup;
[Header("Timer Flash Settings")]
@@ -526,9 +528,11 @@ public class GameManager : NetworkBehaviour
if(team == Team.Blue){
blueScore++;
blueScoreText.text = blueScore.ToString();
PlayGoalEffects(Team.Blue);
}else{
redScore++;
redScoreText.text = redScore.ToString();
PlayGoalEffects(Team.Red);
}
SwitchTeams();
@@ -549,6 +553,38 @@ public class GameManager : NetworkBehaviour
hitCounter = 0;
}
void PlayGoalEffects(Team team){
if(isServer){
m_PlayGoalEffects(team);
RpcPlayGoalEffects(team);
}else{
CmdPlayGoalEffects(team);
}
}
[Command]
void CmdPlayGoalEffects(Team team){
m_PlayGoalEffects(team);
RpcPlayGoalEffects(team);
}
[ClientRpc]
void RpcPlayGoalEffects(Team team){
m_PlayGoalEffects(team);
}
void m_PlayGoalEffects(Team team){
if(team == Team.Blue){
foreach(ParticleSystem effect in blueGoalEffects){
effect.Play();
}
}else{
foreach(ParticleSystem effect in redGoalEffects){
effect.Play();
}
}
}
[ClientRpc]
void RpcPlayGoalScoredSfx()
{
@@ -562,14 +598,12 @@ public class GameManager : NetworkBehaviour
}
void gameOver(Team team){
gameOverPanel.SetActive(true);
if(team == Team.Blue){
blueWon.SetActive(true);
redWon.SetActive(false);
}else{
blueWon.SetActive(false);
redWon.SetActive(true);
}
StartCoroutine(CoroutineGameOver(team));
}
IEnumerator CoroutineGameOver(Team team){
yield return new WaitForSeconds(2f);
LevelLoadManager.instance.SetupGameOver(team,redScore,blueScore);
}
bool freezeInput = false;