using System; using UnityEngine; namespace UFS3 { [CreateAssetMenu(fileName = "RodData", menuName = "Data/RodData")] public class RodData : BaseItemData, IItemType { public enum BlankMaterialType { wood = 0, bamboo = 1, fiberglass = 2, carbon = 3, composite = 4, kevlar = 5, boron = 6, nanoresin = 7 } public enum ActionType { slow = 0, moderate = 1, moderateFast = 2, fast = 3, extraFast = 4 } public enum PowerType { ultralight = 0, light = 1, medium_light = 2, medium = 3, medium_heavy = 4, heavy = 5, extra_heavy = 6 } public enum RodType { spinninig = 0, floating = 1, feeder = 2, casting = 3 } public string manufactureName; public string modelName; [Tooltip("Min Strength is minimal line tension on gear which will be gear damaging, max is for instant kill rod")] [SerializeField] private Vector2 strengthMinMax; public float length; public float strength; public float cwMin; public float cwMax; public BlankMaterialType blankMaterial; public PowerType power; public ActionType action; public BaseItemData AttachedReel; public BaseItemData AttachedLine; public BaseItemData AttachedLure; public ScriptableEventItemData OnGearItemUpdated; public RodType Type; public ItemType ItemType => ItemType.Rod; public float StrengthMin => strengthMinMax.x; public float StrengthMax => strengthMinMax.y; public float GetAction => action switch { ActionType.slow => 0.5f, ActionType.moderate => 1f, ActionType.moderateFast => 1.5f, ActionType.fast => 2f, ActionType.extraFast => 2.5f, _ => throw new ArgumentOutOfRangeException(), }; public string Power => power switch { PowerType.ultralight => "ultralight", PowerType.light => "light", PowerType.medium_light => "medium light", PowerType.medium => "medium", PowerType.medium_heavy => "medium heavy", PowerType.heavy => "heavy", PowerType.extra_heavy => "extra heavy", _ => throw new ArgumentOutOfRangeException(), }; public override string StatisticText => string.Concat(string.Concat(string.Concat(string.Concat(string.Concat(string.Empty + $"Type: {Type}\n", $"Strength: {strength}kg\n"), $"Action: {action}\n"), $"Blank: {blankMaterial}\n"), $"Length: {length}m\n"), $"CW: {cwMin}g - {cwMax}g\n"); public bool IsGearReadyToFishing() { if (AttachedReel != null && AttachedLine != null && AttachedLure != null) { return true; } return false; } public bool AttachGear(BaseItemData itemData) { if (itemData is ReelData) { if (AttachedReel != null) { return false; } AttachedReel = itemData; } else if (itemData is LineData) { if (AttachedLine != null) { return false; } AttachedLine = itemData; } else { if (!(itemData is LureData)) { Debug.LogError("Not implemented!"); return false; } if (AttachedLure != null) { return false; } AttachedLure = itemData; } OnGearItemUpdated.Raise(this); return true; } public void RemoveGear(BaseItemData itemData) { if (itemData == AttachedReel) { AttachedReel = null; } if (itemData == AttachedLine) { AttachedLine = null; } if (itemData == AttachedLure) { AttachedLure = null; } OnGearItemUpdated.Raise(this); } } }