2026-06-19 UI, UI로직
This commit is contained in:
53
Assets/My project/Fishing Scripts/UI/FishingRewardSystem.cs
Normal file
53
Assets/My project/Fishing Scripts/UI/FishingRewardSystem.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user