Files
Fruitomation/Assets/Scripts/Game/Buildings/Automation/FermenterBuilding.cs
2026-04-27 20:46:34 +01:00

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);
}
}
}