final feedbacks fixed

This commit is contained in:
2026-04-20 14:36:51 +05:30
parent 4ba7623b13
commit f31f90034c
9 changed files with 570 additions and 1989 deletions
+21 -1
View File
@@ -67,6 +67,8 @@ public class GameManager : NetworkBehaviour
public bool m_isMoving =false;
[SyncVar(hook = nameof(OnGameStartedChanged))]
public bool gameStarted = false;
[SyncVar]
public bool isGameEnded = false;
void OnGameStartedChanged(bool oldStarted, bool newStarted){
if(newStarted){
GameCanvas.instance.HideWaitingForOpponentPanel();
@@ -509,18 +511,33 @@ public class GameManager : NetworkBehaviour
}
Team GetOpposingTeam(Team team){
return team == Team.Red ? Team.Blue : Team.Red;
}
void SetKickoffTeam(Team kickoffTeam){
turnTimerCounter = 0;
SelectedTeam = kickoffTeam;
OnTeamChanged?.Invoke(SelectedTeam);
}
public void OnGoal(Team team){
if(!isServer){
Debug.LogWarning("OnGoal called on client, skipping");
return;}
if(!CanProcessGoal){
return;
}
RpcPlayGoalScoredSfx();
freezeInput=true;
Team concedingTeam = GetOpposingTeam(team);
if(hitCounter == 1){
//kickoff goal
Logger.Log("Kickoff goal");
SetKickoffTeam(concedingTeam);
StartCoroutine(CoroutineOnGoal(team,true));//true = Kickoff goal, reset only the ball
hitCounter = 0;
@@ -536,14 +553,16 @@ public class GameManager : NetworkBehaviour
PlayGoalEffects(Team.Red);
}
SwitchTeams();
SetKickoffTeam(concedingTeam);
if(blueScore >= 3){
isGameEnded = true;
ReportDedicatedMatchGameOver(Team.Blue);
RpcGameOver(Team.Blue);
gameOver(Team.Blue);
}else if(redScore >= 3){
isGameEnded = true;
ReportDedicatedMatchGameOver(Team.Red);
RpcGameOver(Team.Red);
gameOver(Team.Red);
@@ -680,6 +699,7 @@ public class GameManager : NetworkBehaviour
}
bool freezeInput = false;
public bool CanProcessGoal => isServer && !freezeInput && !isGameEnded;
IEnumerator CoroutineOnGoal(Team team, bool kickoff = false){
if(coroutinePostLaunch!=null){