Added item registry
This commit is contained in:
@@ -1,21 +1,8 @@
|
||||
using System;
|
||||
using Fruitomation.Global;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation.Game.Items
|
||||
{
|
||||
public enum ItemType
|
||||
{
|
||||
Apple,
|
||||
Grape,
|
||||
Banana,
|
||||
Kiwi,
|
||||
Mango,
|
||||
Pitaya,
|
||||
Durian,
|
||||
BuddhasHand
|
||||
}
|
||||
|
||||
public class ItemBehaviour : MonoBehaviour
|
||||
{
|
||||
protected RectTransform RectTransform { get; private set; }
|
||||
@@ -99,6 +86,13 @@ namespace Fruitomation.Game.Items
|
||||
|
||||
public void TriggerDestruction(bool harvest = true)
|
||||
{
|
||||
if (harvest)
|
||||
{
|
||||
ItemInfo info = ItemInfoRegistry.Get(CurrentType);
|
||||
float money = Random.Range(info.MinMoney, info.MaxMoney);
|
||||
MoneyController.Add(money);
|
||||
}
|
||||
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user