42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Fruitomation.Game.Items;
|
|
using UnityEngine;
|
|
|
|
namespace Fruitomation.Game
|
|
{
|
|
public class FermenterBuilding : Building
|
|
{
|
|
[Header("Fermenter 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.GrapeJuice => UpgradeManager.Is(BasicUpgrade.Wine)
|
|
? ItemType.Wine
|
|
: ItemType.GrapeJuice,
|
|
|
|
ItemType.KiwiJuice => UpgradeManager.Is(BasicUpgrade.KiwiVinegar)
|
|
? ItemType.KiwiVinegar
|
|
: ItemType.KiwiJuice,
|
|
|
|
var _ => item.CurrentType // Default
|
|
};
|
|
|
|
item.transform.position = OutputLocation.position;
|
|
item.SendToTheGhostRealm();
|
|
|
|
}, TriggerType.Enter);
|
|
}
|
|
}
|
|
}
|