mirror of
				https://github.com/DerTyp7/defrain-shooter-unity.git
				synced 2025-10-31 05:27:07 +01:00 
			
		
		
		
	Started Keybinds (1,2,3,4)
added: "Weapon1","Weapon2","Weapon3","Weapon4" to InputManager and started implementing Keybinds for weapons
This commit is contained in:
		| @@ -9,6 +9,7 @@ public class DebugCanvas : MonoBehaviour | ||||
| { | ||||
|     public TextMeshProUGUI DebugTextGrounded; | ||||
|     public TextMeshProUGUI DebugTextClientServer; | ||||
|     public TextMeshProUGUI DebugAmmunition; | ||||
|     public GameObject Player; | ||||
|     public GameObject GameManager; | ||||
|     public TextMeshProUGUI fpsText; | ||||
| @@ -36,6 +37,8 @@ public class DebugCanvas : MonoBehaviour | ||||
|         else | ||||
|         { | ||||
|             DebugTextGrounded.text = "isGrounded: " + Player.GetComponent<PlayerController>().isGrounded.ToString(); | ||||
|             Shoot shoot = Player.GetComponent<Shoot>(); | ||||
|             DebugAmmunition.text = shoot.CurAmmo + " / " + shoot.TotalAmmo; | ||||
|             deltaTime += (Time.deltaTime - deltaTime) * 0.1f; | ||||
|             float fps = 1.0f / deltaTime; | ||||
|             fpsText.text = Mathf.Ceil(fps).ToString() + "FPS"; | ||||
|   | ||||
| @@ -8,6 +8,7 @@ public class Weapon : MonoBehaviour | ||||
|     { | ||||
|         Rifle, Pistole, Knife, Grenade | ||||
|     } | ||||
|     [SerializeField] string WeaponName; | ||||
|     [SerializeField] weaponKinds weaponKind; | ||||
|     [SerializeField] bool active = false; | ||||
|     [SerializeField] int damage = 0; | ||||
| @@ -38,9 +39,10 @@ public class Weapon : MonoBehaviour | ||||
|     public Transform GunLeftREF { get => gunLeftREF; } | ||||
|     public Transform GunRightREF { get => gunRightREF; } | ||||
|  | ||||
|     private void Start() | ||||
|     private void Awake() | ||||
|     { | ||||
|         CurrentAmmunition = MagazinSize; | ||||
|         WeaponName = transform.name; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -25,12 +25,19 @@ public class WeaponManager : NetworkBehaviour | ||||
|  | ||||
|     void Update() { | ||||
|         if (isLocalPlayer) { | ||||
|             if (Input.GetAxis("Mouse ScrollWheel") > 0f) { // Scroll up | ||||
|             if (Input.GetButtonDown("Weapon1")) { | ||||
|                 currentWeaponIndex = 0; | ||||
|             }else if (Input.GetButtonDown("Weapon2")) { | ||||
|                 currentWeaponIndex = 1; | ||||
|             }else if (Input.GetButtonDown("Weapon3")) { | ||||
|                 currentWeaponIndex = 2; | ||||
|             }else if (Input.GetButtonDown("Weapon4")) { | ||||
|                 currentWeaponIndex = 4;  | ||||
|             }else if (Input.GetAxis("Mouse ScrollWheel") > 0f) { // Scroll up | ||||
|                 lastWeaponIndex = currentWeaponIndex; | ||||
|                 activeWeapons[currentWeaponIndex].SetActive(false); | ||||
|                 switchWeapon(-1); | ||||
|             } | ||||
|             else if (Input.GetAxis("Mouse ScrollWheel") < 0f) { // Scroll down | ||||
|             }else if (Input.GetAxis("Mouse ScrollWheel") < 0f) { // Scroll down | ||||
|                 lastWeaponIndex = currentWeaponIndex; | ||||
|                 activeWeapons[currentWeaponIndex].SetActive(false); | ||||
|                 switchWeapon(1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Noah4ever
					Noah4ever