12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- using KairoEngine.SFX;
- namespace KairoEngine.Inventory
- {
- public enum FirearmType
- {
- pistol,
- rifle
- }
- [CreateAssetMenu(fileName = "Item", menuName = "KairoEngine/Items/Weapon Item", order = 3)]
- public class ItemBaseFirearm : ItemBaseHoldable
- {
- [TitleGroup("Weapon Properties")]
- public FirearmType firearmType;
- [TitleGroup("Weapon Properties")]
- public int damage = 1;
-
- [TitleGroup("Weapon Properties")]
- public bool isAutomatic = false;
- [TitleGroup("Weapon Properties"), SuffixLabel("shoots", true)]
- public int burstFire = 1;
-
- [TitleGroup("Weapon Properties"), SuffixLabel("seconds", true)]
- public float firingSpeed = 0.2f;
-
- [TitleGroup("Weapon Properties"), SuffixLabel("seconds", true)]
- public float reloadSpeed = 1.5f;
-
- [TitleGroup("Weapon Properties")]
- public ItemBaseAmmo ammoType;
-
- [TitleGroup("Weapon Properties")]
- public int ammoCapacity;
- [TitleGroup("Weapon Properties")]
- public int bulletsPerShot = 1;
- [Tooltip("Weapon acuracy ranges perfect accuracy at 100% to total random directions at 0%")]
- [TitleGroup("Weapon Properties"), Range(0, 100), SuffixLabel("%", true)]
- public float accuracy;
- [Tooltip("Adds this percentage to the critial hit chance at each bullet hit")]
- [TitleGroup("Weapon Properties"), Range(0, 100), SuffixLabel("%", true)]
- public float criticalChanceModifier = 3f;
- [TitleGroup("Weapon Properties"), LabelText("Point Blank distance"), SuffixLabel("min", true)]
- public float minDistance = 1.5f;
- [TitleGroup("Weapon Properties"), LabelText("Half distance"), SuffixLabel("half", true)]
- public float halfDistance = 12f;
- [TitleGroup("Weapon Properties"), LabelText("Max travel distance"), SuffixLabel("max", true)]
- public float maxDistance = 20f;
- [TitleGroup("Weapon Properties")]
- public SFXClip shootSound;
- [TitleGroup("Weapon Properties")]
- public SFXClip emptySound;
-
- [TitleGroup("Weapon Properties")]
- public SFXClip reloadSound;
- public int CalculateDamage(ItemFirearmRef firearmRef, Vector3 firearmPos, Vector3 impactPos)
- {
- return damage + ammoType.damageModifier;
- }
- public float Accuracy(ItemFirearmRef firearmRef)
- {
- return accuracy + ammoType.accuracyModifier;
- }
- }
- }
|