Skip to content

Commit 90e085d

Browse files
committed
Refactor ammo UI, update vehicle logic, and move icons
Refactored the vehicle HUD to display separate bullet and rocket ammo slots with reload counts, updating related USS and UXML files. Added new bullet and rocket icons, moved all vehicle UI icons to a centralized Icons folder, and updated references. Improved vehicle and building logic, including more granular fuel consumption rates and enhanced destruction notifications. Adjusted ammunition and vehicle asset parameters for better gameplay balance.
1 parent fef0b65 commit 90e085d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+471
-65
lines changed

Red Strike/Assets/AmmunitionSystem/Ammunition.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class Ammunition : ScriptableObject
99
public AmmunitionType ammunitionType;
1010
public string ammunitionName;
1111
public float speed;
12+
public float rotationSpeed;
1213
public float range;
1314
public float lifetime;
1415
public GameObject ammunitionPrefab;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ MonoBehaviour:
1414
m_EditorClassIdentifier:
1515
ammunitionType: 2
1616
ammunitionName: Basic Rocket
17-
damage: 90
18-
speed: 40
17+
speed: 65
18+
rotationSpeed: 45
1919
range: -1
2020
lifetime: 10
2121
ammunitionPrefab: {fileID: 595683329615967435, guid: ab318667f38c4db4ebc5472f6d16eed0, type: 3}

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@ namespace AmmunitionSystem.Ammunitions.BasicRocket
66
{
77
public class BasicRocket : Ammunition
88
{
9-
public float speed = 20f;
10-
public float rotationSpeed = 5f;
119
public float accelerationRate = 1.5f;
1210

1311
private bool hasExploded = false;
1412
private float currentSpeed;
1513
[Networked] public NetworkId TargetId { get; set; }
1614

17-
private void Awake()
18-
{
19-
currentSpeed = speed * 0.5f;
20-
}
21-
2215
public override void SetRocketTarget(NetworkId targetId)
2316
{
2417
TargetId = targetId;
@@ -29,7 +22,7 @@ public override void FixedUpdateNetwork()
2922
if (!Object.HasStateAuthority) return;
3023
if (hasExploded) return;
3124

32-
currentSpeed = Mathf.Lerp(currentSpeed, speed, Runner.DeltaTime * accelerationRate);
25+
currentSpeed = Mathf.Lerp(currentSpeed, ammunitionData.speed, Runner.DeltaTime * accelerationRate);
3326
float dt = Runner.DeltaTime;
3427

3528
if (TargetId.IsValid)
@@ -41,7 +34,7 @@ public override void FixedUpdateNetwork()
4134
if (direction != Vector3.zero)
4235
{
4336
Quaternion targetRotation = Quaternion.LookRotation(direction);
44-
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, dt * rotationSpeed);
37+
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, dt * ammunitionData.rotationSpeed);
4538
}
4639
}
4740
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ MonoBehaviour:
1414
m_EditorClassIdentifier:
1515
ammunitionType: 0
1616
ammunitionName: Tank Shell
17-
damage: 50
18-
speed: 50
17+
speed: 60
18+
rotationSpeed: 0
1919
range: -1
2020
lifetime: 3
2121
ammunitionPrefab: {fileID: 5858476706136754781, guid: 19c3186beb4233a4c90ef4811e6851f6, type: 3}

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ public class Building : Unit.Unit
1515

1616
public override void Spawned()
1717
{
18-
if (Object.HasStateAuthority)
19-
{
20-
health = buildingData.maxHealth;
21-
maxHealth = buildingData.maxHealth;
22-
buildingName = buildingData.buildingName;
23-
}
18+
health = buildingData.maxHealth;
19+
maxHealth = buildingData.maxHealth;
20+
buildingName = buildingData.buildingName;
2421
}
25-
22+
2623
public override void TakeDamage(float damage)
2724
{
2825
if (!Object.HasStateAuthority) return;
@@ -33,7 +30,11 @@ public override void TakeDamage(float damage)
3330

3431
if (health <= 0)
3532
{
36-
//Debug.Log($"Building {BuildingName} destroyed.");
33+
NotificationSystem.NotificationSystem.Show(
34+
"Building Destroyed",
35+
$"{buildingName} has been destroyed.",
36+
NotificationSystem.NotificationType.Warning
37+
);
3738

3839
ParticleSystem exp = Instantiate(buildingData.explosionEffect, transform.position, Quaternion.identity);
3940
Destroy(exp.gameObject, exp.main.duration);
@@ -65,8 +66,6 @@ private void OnCollisionEnter(Collision collision)
6566

6667
if (unit.teamId == teamId)
6768
return;
68-
69-
//Debug.Log($"Building {BuildingName} collided with unit: {collision.gameObject.name}");
7069
}
7170
}
7271
}
File renamed without changes.
File renamed without changes.

Red Strike/Assets/Icons/Bullet.png

3.76 KB

Red Strike/Assets/Icons/Bullet.png.meta

Lines changed: 130 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)