47 lines
1.0 KiB
C#
47 lines
1.0 KiB
C#
using UnityEngine;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class AirGate : MonoBehaviour
|
|
{
|
|
private EngineSystem _engineSystem;
|
|
|
|
private SpriteButton _upButton;
|
|
private SpriteButton _downButton;
|
|
|
|
private void Awake()
|
|
{
|
|
_engineSystem = transform.parent.GetComponent<EngineSystem>();
|
|
|
|
var up = transform.Find("Up").gameObject;
|
|
var down = transform.Find("Down").gameObject;
|
|
|
|
_upButton = new SpriteButton(up);
|
|
_downButton = new SpriteButton(down);
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
_upButton.OnButtonDown += AddAirLevel;
|
|
_downButton.OnButtonDown += SubtractAirLevel;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
_upButton?.CheckButtonClick();
|
|
_downButton?.CheckButtonClick();
|
|
}
|
|
|
|
private void AddAirLevel()
|
|
{
|
|
_engineSystem.AddAirLevel();
|
|
}
|
|
|
|
private void SubtractAirLevel()
|
|
{
|
|
_engineSystem.SubtractAirLevel();
|
|
}
|
|
}
|
|
}
|
|
|