mirror of
				https://github.com/DerTyp7/defrain-shooter-unity.git
				synced 2025-10-30 04:57:10 +01:00 
			
		
		
		
	Grenade Data Location
Grenade data is now on Grenade.cs and not on Weapon.cs. You need both scripts to make a grenade work
This commit is contained in:
		| @@ -8,6 +8,7 @@ public class Weapon : MonoBehaviour | ||||
|     { | ||||
|         Rifle, Pistole, Knife, Grenade | ||||
|     } | ||||
|     [Header("Weapon Info")] | ||||
|     [SerializeField] weaponKinds weaponKind; | ||||
|     [SerializeField] float dropForce = 10f; | ||||
|     [SerializeField] int damage = 0; | ||||
| @@ -18,18 +19,15 @@ public class Weapon : MonoBehaviour | ||||
|     [SerializeField] int totalAmmunition = 0; | ||||
|     [SerializeField] GameObject bulletExit; | ||||
|     [SerializeField] bool allowAction = true; | ||||
|     [Header("")] | ||||
|     [SerializeField] Animator weaponAnimator; | ||||
|     [SerializeField] Transform gunRightREF; | ||||
|     [SerializeField] Transform gunLeftREF; | ||||
|     [Header("Grenade")] | ||||
|     [SerializeField] bool isGrenade = false; | ||||
|     [SerializeField] float timer = 2f; | ||||
|     [SerializeField] float explosionForce = 2f; | ||||
|     [SerializeField] float grenadeRadius = 3f; | ||||
|     [SerializeField] bool hasExploded = false; | ||||
|     [SerializeField] bool hasBeenThrown = false; | ||||
|     //[Header("Grenade")] | ||||
|     private bool hasBeenThrown = false; | ||||
|  | ||||
|     public weaponKinds WeaponKind { get => weaponKind; } | ||||
|     public float DropForce { get => dropForce; set => dropForce = value; } | ||||
|     public int Damage { get => damage; set => damage = value; } | ||||
|     public float Firerate { get => firerate; set => firerate = value; } | ||||
|     public float RecoilStrength { get => recoilStrength; set => recoilStrength = value; } | ||||
| @@ -41,18 +39,10 @@ public class Weapon : MonoBehaviour | ||||
|     public Animator WeaponAnimator { get => weaponAnimator; } | ||||
|     public Transform GunLeftREF { get => gunLeftREF; } | ||||
|     public Transform GunRightREF { get => gunRightREF; } | ||||
|     public float Timer { get => timer; set => timer = value; } | ||||
|     public float GrenadeRadius { get => grenadeRadius; set => grenadeRadius = value; } | ||||
|     public bool HasExploded { get => hasExploded; set => hasExploded = value; } | ||||
|     public bool IsGrenade { get => isGrenade; set => isGrenade = value; } | ||||
|     public bool HasBeenThrown { get => hasBeenThrown; set => hasBeenThrown = value; } | ||||
|     public float ExplosionForce { get => explosionForce; set => explosionForce = value; } | ||||
|     public float DropForce { get => dropForce; set => dropForce = value; } | ||||
|  | ||||
|     private void Start() { | ||||
|         CurrentAmmunition = MagazinSize; | ||||
|         if (weaponKind == weaponKinds.Grenade) { IsGrenade = true; } | ||||
|         if (IsGrenade) { weaponKind = weaponKinds.Grenade; } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Noah4ever
					Noah4ever