Skip to content

Commit 9bd414a

Browse files
committed
Add Game Over UI and logic integration
Introduces a Game Over panel to the HUD, with supporting styles and controller logic. The MainStation destruction now triggers a game over state, displays the overlay, and disconnects the player from the network. Includes new GameOverHUDController, updates to GameHUDController, and related UI/UX improvements.
1 parent 2a4ce48 commit 9bd414a

File tree

12 files changed

+166
-46
lines changed

12 files changed

+166
-46
lines changed

Red Strike/Assets/BuildingPlacement/Buildings/MainStation/MainStation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected override void OnDestroy()
2424

2525
if (GameStateSystem.GameStateManager.Instance != null)
2626
{
27-
GameStateSystem.GameStateManager.Instance.MainStationDestroyed();
27+
GameStateSystem.GameStateManager.Instance.GameOver();
2828
}
2929
}
3030
}

Red Strike/Assets/GameStateSystem/GameStateManager.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using NetworkingSystem;
12
using UnityEngine;
23

34
namespace GameStateSystem
@@ -22,10 +23,16 @@ private void Start()
2223
CurrentState = GameState.InGame;
2324
}
2425

25-
public void MainStationDestroyed()
26+
public void GameOver()
2627
{
27-
Debug.Log("Main Station has been destroyed! Game Over.");
28+
Debug.Log("Oyun Bitti!");
2829
CurrentState = GameState.GameOver;
30+
UISystem.GameOverHUDController gameOverHUDController = FindAnyObjectByType<UISystem.GameOverHUDController>();
31+
if (gameOverHUDController != null)
32+
{
33+
gameOverHUDController.ShowGameOverPanel();
34+
}
35+
CommanderData.LocalCommander?.OnDisconnect();
2936
}
3037
}
3138
}

Red Strike/Assets/NetworkingSystem/CommanderData.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,14 @@ public void RPC_SpawnVehicle(string vehicleName, Vector3 position)
118118
Debug.LogError($"Server: {vehicleData.vehicleName} prefabı bulunamadı!");
119119
}
120120
}
121+
122+
public void OnDisconnect()
123+
{
124+
if (Runner != null && Runner.IsRunning)
125+
{
126+
Debug.Log($"Oyuncu oyundan çıkarılıyor. Takım ID: {PlayerTeamID}");
127+
Runner.Shutdown();
128+
}
129+
}
121130
}
122131
}

Red Strike/Assets/PlanetAtmosphereSystem/AtmosphereMaterial.mat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Material:
4747
- _GunesYonu: {r: -0.91, g: 0.4, b: 3.24, a: 0}
4848
- _RenkUzak: {r: 0, g: 0.10166844, b: 2.152374, a: 1}
4949
- _RenkYakin: {r: 0, g: 5.670685, b: 8, a: 1}
50-
- _SunDirection: {r: 0.113937065, g: 0.75464195, b: -0.6461687, a: 0}
50+
- _SunDirection: {r: -0.04795202, g: -0.9484175, b: 0.31337708, a: 0}
5151
m_BuildTextureStacks: []
5252
m_AllowLocking: 1
5353
--- !u!114 &1522106816477559216

0 commit comments

Comments
 (0)