mirror of
				https://github.com/DerTyp7/defrain-shooter-unity.git
				synced 2025-10-31 05:27:07 +01:00 
			
		
		
		
	 59ff72d498
			
		
	
	59ff72d498
	
	
	
		
			
			When u switch or pickup weapons u have them now in your hand. - Scrollup doesnt work on the highest weapon index (will be fixed soon) - Shooting with the hand will give an error because there is no animation "shoot" on the hand (PLEASE someone make an animation for the hand!!!!)
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| 
 | |
| public class Weapon : MonoBehaviour
 | |
| {
 | |
|     public enum weaponKinds
 | |
|     {
 | |
|         Rifle, Pistole, Knife, Grenade
 | |
|     }
 | |
|     [SerializeField] weaponKinds weaponKind;
 | |
|     [SerializeField] bool active = false;
 | |
|     [SerializeField] int damage = 0;
 | |
|     [SerializeField] float firerate = 0;
 | |
|     [SerializeField] int roundsPerShot = 1;
 | |
|     [SerializeField] float recoilStrength = 0;
 | |
|     [SerializeField] int currentAmmunition = 0;
 | |
|     [SerializeField] int magazinSize = 0;
 | |
|     [SerializeField] int totalAmmunition = 0;
 | |
|     [SerializeField] GameObject bulletExit;
 | |
|     [SerializeField] bool allowAction = true;
 | |
|     [SerializeField] Animator weaponAnimator;
 | |
|     [SerializeField] Transform gunRightREF;
 | |
|     [SerializeField] Transform gunLeftREF;
 | |
| 
 | |
|     public bool Active { get => active; set => active = value; }
 | |
|     public weaponKinds WeaponKind { get => weaponKind; }
 | |
|     public int Damage { get => damage; set => damage = value; }
 | |
|     public float Firerate { get => firerate; set => firerate = value; }
 | |
|     public int RoundsPerShot { get => roundsPerShot; set => roundsPerShot = value; }
 | |
|     public float RecoilStrength { get => recoilStrength; set => recoilStrength = value; }
 | |
|     public int CurrentAmmunition { get => currentAmmunition; set => currentAmmunition = value; }
 | |
|     public int MagazinSize { get => magazinSize; set => magazinSize = value; }
 | |
|     public int TotalAmmunition { get => totalAmmunition; set => totalAmmunition = value; }
 | |
|     public GameObject BulletExit { get => bulletExit; }
 | |
|     public bool AllowAction { get => allowAction; set => allowAction = value; }
 | |
|     public Animator WeaponAnimator { get => weaponAnimator; }
 | |
|     public Transform GunLeftREF { get => gunLeftREF; }
 | |
|     public Transform GunRightREF { get => gunRightREF; }
 | |
| 
 | |
|     private void Start()
 | |
|     {
 | |
|         CurrentAmmunition = MagazinSize;
 | |
|     }
 | |
| 
 | |
| }
 |