53 lines
1014 B
C#
53 lines
1014 B
C#
using UnityEngine;
|
|
|
|
public class FishingRewardSystem : MonoBehaviour
|
|
{
|
|
public enum RewardType
|
|
{
|
|
Normal,
|
|
Rare
|
|
}
|
|
|
|
[Header("Reward Chance")]
|
|
[Range(0f, 100f)]
|
|
[SerializeField] private float rareChance = 10f;
|
|
|
|
[Header("Reward Count")]
|
|
[SerializeField] private int normalMemory;
|
|
[SerializeField] private int rareMemory;
|
|
|
|
public int NormalMemory => normalMemory;
|
|
public int RareMemory => rareMemory;
|
|
|
|
public RewardType GiveReward()
|
|
{
|
|
if (Random.value < rareChance / 100f)
|
|
return GiveRareMemory();
|
|
|
|
return GiveNormalMemory();
|
|
}
|
|
|
|
private RewardType GiveNormalMemory()
|
|
{
|
|
normalMemory++;
|
|
|
|
Debug.Log("ÀÏ¹Ý ±â¾ï +1");
|
|
|
|
return RewardType.Normal;
|
|
}
|
|
|
|
private RewardType GiveRareMemory()
|
|
{
|
|
rareMemory++;
|
|
|
|
Debug.Log("Èñ±Í ±â¾ï +1");
|
|
|
|
return RewardType.Rare;
|
|
}
|
|
|
|
public void ResetRewardCount()
|
|
{
|
|
normalMemory = 0;
|
|
rareMemory = 0;
|
|
}
|
|
} |