36 lines
986 B
C#
36 lines
986 B
C#
using UnityEngine;
|
|
|
|
namespace OTGIntegrated.Weapons
|
|
{
|
|
[CreateAssetMenu(fileName = "WeaponData", menuName = "OTG Integrated/Weapon Data")]
|
|
public sealed class WeaponData : ScriptableObject
|
|
{
|
|
public string weaponId;
|
|
public string displayName;
|
|
public float damage = 10f;
|
|
public float attackRate = 0.8f;
|
|
public float range = 2.2f;
|
|
public bool isRanged;
|
|
public float manaCost;
|
|
[TextArea(2, 5)] public string description;
|
|
|
|
private void OnValidate()
|
|
{
|
|
if (string.IsNullOrWhiteSpace(weaponId))
|
|
{
|
|
weaponId = name;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(displayName))
|
|
{
|
|
displayName = weaponId;
|
|
}
|
|
|
|
damage = Mathf.Max(0f, damage);
|
|
attackRate = Mathf.Max(0.05f, attackRate);
|
|
range = Mathf.Max(0.2f, range);
|
|
manaCost = Mathf.Max(0f, manaCost);
|
|
}
|
|
}
|
|
}
|