Files
No-Time-To-Rest/Assets/Scripts/Player/WeaponController.cs
T
KOSMOGOR f899107d08 update: player prefab
fix: pistol not firing with higher fire rate
2025-03-17 15:36:15 +03:00

18 lines
538 B
C#

using System.Collections.Generic;
using UnityEngine;
public class WeaponController : MonoBehaviour
{
[SerializeField] Weapon[] weapons;
[SerializeField] int currentWeapon = 0;
void Start() {
weapons = GetComponentsInChildren<Weapon>();
if (weapons.Length > currentWeapon) weapons[currentWeapon].SetWeaponState(true);
}
void Update() {
if (Input.GetMouseButton(0) && weapons[currentWeapon].isActive) weapons[currentWeapon].Shoot(Input.GetMouseButtonDown(0), Input.GetMouseButton(0));
}
}