add: working rocket launcher

fix: rocket launcher projectile
update: now all weapons are ready to shoot at start
This commit is contained in:
KOSMOGOR
2025-05-01 13:44:17 +03:00
parent 150c6212a2
commit 991d298a65
13 changed files with 534 additions and 2 deletions
+4
View File
@@ -15,6 +15,10 @@ public class Minigun : Weapon
}
}
void Start() {
if (fireRate != 0) currentDelay = 1 / fireRate;
}
void Update() {
if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate);
}
+4
View File
@@ -15,6 +15,10 @@ public class Pistol : Weapon
}
}
void Start() {
if (fireRate != 0) currentDelay = 1 / fireRate;
}
void Update() {
if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate);
}
+4
View File
@@ -15,6 +15,10 @@ public class Rifle : Weapon
}
}
void Start() {
if (fireRate != 0) currentDelay = 1 / fireRate;
}
void Update() {
if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate);
}
+4
View File
@@ -15,6 +15,10 @@ public class RocketLauncher : Weapon
}
}
void Start() {
if (fireRate != 0) currentDelay = 1 / fireRate;
}
void Update() {
if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate);
}
+1 -1
View File
@@ -25,7 +25,7 @@ public class RocketProjectile : MonoBehaviour
Collider[] colliders = Physics.OverlapSphere(transform.position, explosionRadius);
foreach (Collider collider in colliders) {
if (collider.gameObject.CompareTag("Enemy")) {
Enemy enemy = other.GetComponent<Enemy>();
Enemy enemy = collider.GetComponent<Enemy>();
enemy.DealDamage(damage);
}
}