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
+19
View File
@@ -0,0 +1,19 @@
using System.Collections.Generic;
using UnityEngine;
public class WeaponController : MonoBehaviour
{
[SerializeField] Weapon[] weapons;
[SerializeField] int currentWeapon = 0;
void Start() {
weapons = GetComponentsInChildren<Weapon>();
for (int i = 0; i < weapons.Length; ++i) {
if (i != currentWeapon) weapons[i].SetWeaponState(false);
}
}
void Update() {
if (Input.GetMouseButton(0) && weapons[currentWeapon].isActive) weapons[currentWeapon].Shoot(Input.GetMouseButtonDown(0), Input.GetMouseButton(0));
}
}