CapersProject/Assets/02.Scripts/DDD/Prop/Furniture/Bell.cs
2025-02-27 14:29:11 +09:00

56 lines
1.2 KiB
C#

using System;
namespace DDD.Tycoons
{
[Serializable]
public class Bell : InteractionFurniture
{
private bool _activatedBell;
protected override void Start()
{
base.Start();
EventManager.OnEndedBell += EndBell;
HoldingAction = RingedBell;
}
protected override void OnDestroy()
{
base.OnDestroy();
EventManager.OnEndedBell -= EndBell;
}
public override void Interaction()
{
base.Interaction();
GameManager.Instance.CurrentTycoonPlayer.IsCleaningMold = true;
}
public override void CancelInteraction()
{
base.CancelInteraction();
GameManager.Instance.CurrentTycoonPlayer.IsCleaningMold = false;
}
public override bool CanInteraction()
{
return !_activatedBell;
}
public void RingedBell()
{
_activatedBell = true;
EventManager.InvokeRingedBell(transform.position);
}
private void EndBell()
{
_activatedBell = false;
}
}
}