石头
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class PumpButton : MonoBehaviour
|
||||
{
|
||||
private SpriteButton _button;
|
||||
private CoolingMachineViewer _coolingMachine;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_coolingMachine = GetComponentInParent<CoolingMachineViewer>();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_button = new SpriteButton(gameObject);
|
||||
_button.OnButtonDown += OnButtonDown;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_button.OnButtonDown -= OnButtonDown;
|
||||
_button = null;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_button.CheckButtonClick();
|
||||
}
|
||||
|
||||
private void OnButtonDown()
|
||||
{
|
||||
if (!_coolingMachine.CanPump()) return;
|
||||
|
||||
if (_coolingMachine.isMachineEmpty)
|
||||
{
|
||||
_coolingMachine.PumpCooling();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("in");
|
||||
_coolingMachine.InjectCool();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user