RiftMayhem/Assets/Scripts/Interactables/FishingSpotInteractable.cs
Pedro Gomes fdd55142f9 Small class tunning & Rework item drops
- Slight increase to priest, necro and mage scaling
- Updated overall item drops on all enemies:
   - bosses are guaranteed to drop one item
   - drops are weighted and with min/max difficulty restrictions
2025-01-01 20:39:41 +00:00

63 lines
1.4 KiB
C#

using Kryz.CharacterStats.Examples;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FishingSpotInteractable : Interactable
{
[SerializeField] private List<WeightedDrop> dropItems = new List<WeightedDrop>();
public bool interacted = false;
protected Item drop;
protected override void Awake()
{
base.Awake();
}
public override void Interact(bool melee)
{
if (interacted) return;
interacted = true;
base.Interact(melee);
playerController.StartFishing();
StartCoroutine(FindFish());
}
IEnumerator FindFish()
{
yield return new WaitForSeconds(Random.Range(GameConstants.GameBalancing.MinimumFindFishWaitTime, GameConstants.GameBalancing.MaximumFindFishWaitTime));
playerController.GetComponentInChildren<CharacterAnimatorController>().OnPickup();
}
public void OnFishingEnded()
{
drop = WeightedDrop.GetRandomDrop(dropItems);
if(drop != null)
{
Inventory.Instance.AddItem(drop);
}
Destroy(this.gameObject);
}
public override void OnFocused(Transform playerTransform, PlayerController playerController)
{
base.OnFocused(playerTransform, playerController);
}
public override void OnDeFocus()
{
base.OnDeFocus();
}
}