42 lines
839 B
C#
42 lines
839 B
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 bool CanInteraction()
|
|
{
|
|
return !_activatedBell;
|
|
}
|
|
|
|
public void RingedBell()
|
|
{
|
|
_activatedBell = true;
|
|
EventManager.InvokeRingedBell(transform.position);
|
|
}
|
|
|
|
private void EndBell()
|
|
{
|
|
_activatedBell = false;
|
|
}
|
|
}
|
|
} |