add: Level and Game controllers base

update: scripts are now in folders
This commit is contained in:
KOSMOGOR
2025-03-17 15:28:10 +03:00
parent b268225372
commit 2869bfdb33
26 changed files with 171 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
using UnityEngine;
public class Pistol : Weapon
{
public GameObject projectilePrefab;
public Transform spawnPosition;
public float fireRate = 1f;
float currentDelay = 0;
public override void Shoot(bool keyDown, bool keyHold) {
if (keyDown && (fireRate == 0 || currentDelay == 1 / fireRate)) {
Instantiate(projectilePrefab, spawnPosition.position, spawnPosition.rotation);
currentDelay = 0;
}
}
void Update() {
if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate);
}
}