Skip to content

Commit fef2162

Browse files
committed
Remove debug log statements and refactor vehicle code
Commented out or removed various Debug.Log and Debug.LogWarning statements across ammunition, building, networking, and vehicle scripts to clean up console output. Refactored OrnithopterA and OrnithopterB to decrement ammunition correctly and use RPCs for spawning ammunition and rockets. Added DisableMuzzleFlashLights method in Vehicle.cs and replaced string literal in Invoke with nameof for better maintainability.
1 parent 00552fe commit fef2162

File tree

12 files changed

+71
-84
lines changed

12 files changed

+71
-84
lines changed

Red Strike/Assets/AmmunitionSystem/Ammunitions/Ammunitions/BasicBullet/BasicBullet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private void OnCollisionEnter(Collision collision)
4848
return;
4949
}
5050

51-
Debug.Log($"Hit Enemy: {unit.name} - Damage: {ammunitionData.damage}");
51+
//Debug.Log($"Hit Enemy: {unit.name} - Damage: {ammunitionData.damage}");
5252
unit.TakeDamage(ammunitionData.damage);
5353
}
5454

Red Strike/Assets/AmmunitionSystem/Ammunitions/Ammunitions/BasicRocket/BasicRocket.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private void OnCollisionEnter(Collision collision)
6969
return;
7070
}
7171

72-
Debug.Log($"Hit unit: {collision.gameObject.name}, Damage: {ammunitionData.damage}");
72+
//Debug.Log($"Hit unit: {collision.gameObject.name}, Damage: {ammunitionData.damage}");
7373
unit.TakeDamage(ammunitionData.damage);
7474

7575
hasExploded = true;

Red Strike/Assets/AmmunitionSystem/Ammunitions/Ammunitions/BasicTankShell/BasicTankShell.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private void OnCollisionEnter(Collision collision)
4545
return;
4646
}
4747

48-
Debug.Log($"Hit unit: {collision.gameObject.name}, Damage: {ammunitionData.damage}");
48+
//Debug.Log($"Hit unit: {collision.gameObject.name}, Damage: {ammunitionData.damage}");
4949
unit.TakeDamage(ammunitionData.damage);
5050

5151
hasExploded = true;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public override void TakeDamage(float damage)
3131

3232
if (health <= 0)
3333
{
34-
Debug.Log($"Building {BuildingName} destroyed.");
34+
//Debug.Log($"Building {BuildingName} destroyed.");
3535

3636
ParticleSystem exp = Instantiate(buildingData.explosionEffect, transform.position, Quaternion.identity);
3737
Destroy(exp.gameObject, exp.main.duration);
@@ -63,7 +63,7 @@ private void OnCollisionEnter(Collision collision)
6363
if (unit.teamId == teamId)
6464
return;
6565

66-
Debug.Log($"Building {BuildingName} collided with unit: {collision.gameObject.name}");
66+
//Debug.Log($"Building {BuildingName} collided with unit: {collision.gameObject.name}");
6767
}
6868
}
6969
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public void CreateVehicle(VehicleTypes vehicleType)
2727
InProductionUnitName = vehicleType.ToString();
2828
IsReady = false;
2929

30-
Debug.Log($"Hangar started creating a new vehicle: {InProductionUnitName}");
30+
//Debug.Log($"Hangar started creating a new vehicle: {InProductionUnitName}");
3131
CreateVehicleInstance(vehicleType);
3232
}
3333
else
3434
{
35-
Debug.LogWarning("Hangar is not ready to create a new vehicle or already in production.");
35+
//Debug.LogWarning("Hangar is not ready to create a new vehicle or already in production.");
3636
}
3737
}
3838

Red Strike/Assets/InputController/InputController.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private void Update()
6262
if (currentSelectedBuilding != null)
6363
{
6464
currentSelectedBuilding = null;
65-
Debug.Log("Bina yerleştirme iptal edildi.");
65+
//Debug.Log("Bina yerleştirme iptal edildi.");
6666
}
6767
else
6868
{
@@ -121,32 +121,32 @@ private void PlaceBuilding()
121121

122122
if (currentSelectedBuilding.buildingName != "Main Station" && !isThereMainBuilding)
123123
{
124-
Debug.LogWarning("Önce bir Ana Üs (Main Station) yerleştirmelisiniz!");
124+
//Debug.LogWarning("Önce bir Ana Üs (Main Station) yerleştirmelisiniz!");
125125
return;
126126
}
127127

128128
if (currentSelectedBuilding.buildingName == "Main Station" && isThereMainBuilding)
129129
{
130-
Debug.LogWarning("Zaten bir Ana Üs'sünüz var.");
130+
//Debug.LogWarning("Zaten bir Ana Üs'sünüz var.");
131131
return;
132132
}
133133

134134
if (CommanderData.LocalCommander != null)
135135
{
136136
CommanderData.LocalCommander.RPC_SpawnBuilding(currentSelectedBuilding.buildingName, spawnPosition);
137-
Debug.Log($"<color=green>Server'a İstek:</color> {currentSelectedBuilding.buildingName} kuruluyor...");
137+
//Debug.Log($"<color=green>Server'a İstek:</color> {currentSelectedBuilding.buildingName} kuruluyor...");
138138
}
139139
else
140140
{
141-
Debug.LogError("HATA: LocalCommander (Network Bağlantısı) bulunamadı!");
141+
//Debug.LogError("HATA: LocalCommander (Network Bağlantısı) bulunamadı!");
142142
return;
143143
}
144144

145145
currentSelectedBuilding = null;
146146
}
147147
else
148148
{
149-
Debug.Log("Bu alan inşaat için uygun değil (Çok yakın veya engel var).");
149+
//Debug.Log("Bu alan inşaat için uygun değil (Çok yakın veya engel var).");
150150
}
151151
}
152152
}
@@ -164,11 +164,11 @@ public void SelectBuildingToPlace(string buildingName)
164164
if (buildingToSelect != null)
165165
{
166166
currentSelectedBuilding = buildingToSelect;
167-
Debug.Log($"Seçilen: {currentSelectedBuilding.buildingName}. Yere tıklayın.");
167+
//Debug.Log($"Seçilen: {currentSelectedBuilding.buildingName}. Yere tıklayın.");
168168
}
169169
else
170170
{
171-
Debug.LogError($"Database Hatası: {buildingName} bulunamadı!");
171+
//Debug.LogError($"Database Hatası: {buildingName} bulunamadı!");
172172
}
173173
}
174174

@@ -197,7 +197,7 @@ private void HandleObjectSelection()
197197
{
198198
if (currentSelectedVehicle != null)
199199
{
200-
Debug.Log($"Saldırı Emri: {currentSelectedVehicle.name} -> {unit.name}");
200+
//Debug.Log($"Saldırı Emri: {currentSelectedVehicle.name} -> {unit.name}");
201201
currentSelectedVehicle.SetTargetEnemy(unit.gameObject);
202202

203203
if (targetHighlighter != null) targetHighlighter.DisableHighlight();
@@ -206,7 +206,7 @@ private void HandleObjectSelection()
206206
}
207207
else
208208
{
209-
Debug.Log("Düşmanı seçmek için önce kendi aracınızı seçin.");
209+
//Debug.Log("Düşmanı seçmek için önce kendi aracınızı seçin.");
210210
}
211211
return;
212212
}

Red Strike/Assets/NetworkingSystem/CommanderData.cs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ public override void Spawned()
1919

2020
if (Object.HasInputAuthority)
2121
{
22-
Debug.Log($"Benim Komutan objem yüklendi! (Spawned)");
22+
//Debug.Log($"Benim Komutan objem yüklendi! (Spawned)");
2323
LocalCommander = this;
2424
}
2525
else
2626
{
27-
Debug.Log($"Rakibin Komutan objesi yüklendi.");
27+
//Debug.Log($"Rakibin Komutan objesi yüklendi.");
2828
}
2929
}
3030

@@ -46,7 +46,7 @@ public override void Render()
4646
{
4747
InputController.InputController.Instance.teamId = PlayerTeamID;
4848
GameStateSystem.GameStateManager.Instance.LocalPlayerTeamId = PlayerTeamID;
49-
Debug.Log($"<color=yellow>ZORLA EŞİTLEME:</color> InputController ve GameStateManager ID'leri {PlayerTeamID} olarak düzeltildi.");
49+
//Debug.Log($"<color=yellow>ZORLA EŞİTLEME:</color> InputController ve GameStateManager ID'leri {PlayerTeamID} olarak düzeltildi.");
5050
}
5151
}
5252
}
@@ -60,7 +60,7 @@ private void OnTeamIdChanged()
6060
{
6161
InputController.InputController.Instance.teamId = PlayerTeamID;
6262
GameStateSystem.GameStateManager.Instance.LocalPlayerTeamId = PlayerTeamID;
63-
Debug.Log($"<color=green>GÜNCELLEME:</color> Takım ID'si {PlayerTeamID} olarak değişti ve ayarlandı!");
63+
//Debug.Log($"<color=green>GÜNCELLEME:</color> Takım ID'si {PlayerTeamID} olarak değişti ve ayarlandı!");
6464
}
6565
}
6666
}
@@ -81,13 +81,9 @@ public void RPC_SpawnBuilding(string buildingName, Vector3 position)
8181
if (unitScript != null)
8282
{
8383
unitScript.teamId = PlayerTeamID;
84-
Debug.Log($"Bina kuruldu ({buildingName}). Takım ID: {PlayerTeamID} atandı.");
84+
//Debug.Log($"Bina kuruldu ({buildingName}). Takım ID: {PlayerTeamID} atandı.");
8585
}
8686
}
87-
else
88-
{
89-
Debug.LogError($"Server: {buildingName} prefabı bulunamadı!");
90-
}
9187
}
9288

9389
[Rpc(RpcSources.InputAuthority, RpcTargets.StateAuthority)]
@@ -106,13 +102,9 @@ public void RPC_SpawnVehicle(string vehicleName, Vector3 position)
106102
if (unitScript != null)
107103
{
108104
unitScript.teamId = PlayerTeamID;
109-
Debug.Log($"Araç üretildi ({vehicleData.vehicleName}). Takım ID: {PlayerTeamID} atandı.");
105+
//Debug.Log($"Araç üretildi ({vehicleData.vehicleName}). Takım ID: {PlayerTeamID} atandı.");
110106
}
111107
}
112-
else
113-
{
114-
Debug.LogError($"Server: {vehicleData.vehicleName} prefabı bulunamadı!");
115-
}
116108
}
117109

118110

@@ -147,7 +139,7 @@ public void RPC_SpawnAmmunition(
147139
ammunitionScript.SetRocketTarget(targetId);
148140
}
149141

150-
Debug.Log($"Mühimmat fırlatıldı: {ammunitionName}. Takım: {vehicleScript.teamId}");
142+
//Debug.Log($"Mühimmat fırlatıldı: {ammunitionName}. Takım: {vehicleScript.teamId}");
151143
}
152144
}
153145
}

Red Strike/Assets/NetworkingSystem/PlayerSpawner.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ public class PlayerSpawner : SimulationBehaviour, IPlayerJoined
1010

1111
public void PlayerJoined(PlayerRef player)
1212
{
13-
if (Runner.IsServer)
14-
{
15-
Debug.Log($"Oyuncu Katıldı: {player.PlayerId}. Objesi oluşturuluyor...");
16-
17-
NetworkObject networkPlayer = Runner.Spawn(_playerCommanderPrefab, Vector3.zero, Quaternion.identity, player);
18-
19-
var commanderData = networkPlayer.GetComponent<CommanderData>();
20-
21-
int teamIDToAssign = player.PlayerId;
22-
23-
commanderData.PlayerTeamID = teamIDToAssign;
24-
25-
Debug.Log($"Oyuncu {player.PlayerId} için Takım ID {teamIDToAssign} atandı.");
26-
}
13+
if (Runner.IsServer)
14+
{
15+
//Debug.Log($"Oyuncu Katıldı: {player.PlayerId}. Objesi oluşturuluyor...");
16+
17+
NetworkObject networkPlayer = Runner.Spawn(_playerCommanderPrefab, Vector3.zero, Quaternion.identity, player);
18+
19+
var commanderData = networkPlayer.GetComponent<CommanderData>();
20+
21+
int teamIDToAssign = player.PlayerId;
22+
23+
commanderData.PlayerTeamID = teamIDToAssign;
24+
25+
//Debug.Log($"Oyuncu {player.PlayerId} için Takım ID {teamIDToAssign} atandı.");
26+
}
2727
}
2828
}
2929
}

Red Strike/Assets/VehicleSystem/Vehicles/AirVehicle.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public override void FixedUpdateNetwork()
7171
}
7272
else
7373
{
74-
// Durum makinesi
7574
switch (currentState)
7675
{
7776
case AirState.TakingOff: HandleTakingOff(); break;
@@ -84,7 +83,6 @@ public override void FixedUpdateNetwork()
8483
ConsumeFuel();
8584
}
8685

87-
// Konumu Network'e yaz
8886
NetworkedPosition = transform.position;
8987
NetworkedRotation = transform.rotation;
9088
}

Red Strike/Assets/VehicleSystem/Vehicles/OrnithopterA/OrnithopterA.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,13 @@ protected override void FireShot()
3535
for (int i = 0; i < barrelPoints.Length; i++)
3636
{
3737
Transform barrelPoint = barrelPoints[i];
38-
3938
CommanderData.LocalCommander.RPC_SpawnAmmunition(ammunition_bullet.ammunitionName, barrelPoint.position, rotation, Object);
39+
currentAmmunition_bullet--;
4040
}
41-
42-
currentAmmunition_bullet -= 2;
4341
}
4442

4543
protected override void LaunchRocket()
4644
{
47-
Debug.LogWarning("Ornithopter A: LaunchRocket called, BUT: Not Spawning Yet");
4845
NetworkId targetId = default;
4946
if (targetObject != null)
5047
targetId = targetObject.GetComponent<NetworkObject>().Id;
@@ -69,7 +66,6 @@ protected override void ReloadRocketAmmunition()
6966
{
7067
base.ReloadRocketAmmunition();
7168
RocketObjectVisibility(true);
72-
Debug.Log("Rockets Reloaded");
7369
}
7470

7571
private void RocketObjectVisibility(bool isVisible)

0 commit comments

Comments
 (0)