42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Fruitomation.Game.Items;
|
|
using UnityEngine;
|
|
|
|
namespace Fruitomation.Game
|
|
{
|
|
public class GrinderBuilding : Building
|
|
{
|
|
[Header("Grinder Specific")]
|
|
[SerializeField] private RectTransform OutputLocation;
|
|
[SerializeField] private TriggerDetector Trigger;
|
|
|
|
private void Start()
|
|
{
|
|
Trigger.SetAction(other =>
|
|
{
|
|
bool isItem = other.transform.parent.TryGetComponent(out ItemBehaviour item);
|
|
if (!isItem)
|
|
{
|
|
return;
|
|
}
|
|
|
|
item.CurrentType = item.CurrentType switch
|
|
{
|
|
ItemType.KiwiSeeds => UpgradeManager.Is(BasicUpgrade.KiwiSeedOil)
|
|
? ItemType.KiwiSeedOil
|
|
: ItemType.KiwiSeeds,
|
|
|
|
ItemType.Durian => UpgradeManager.Is(BasicUpgrade.DurianPowder)
|
|
? ItemType.DurainPowder
|
|
: ItemType.Durian,
|
|
|
|
var _ => item.CurrentType
|
|
};
|
|
|
|
item.transform.position = OutputLocation.position;
|
|
item.SendToTheGhostRealm();
|
|
|
|
}, TriggerType.Enter);
|
|
}
|
|
}
|
|
}
|