47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using Fruitomation.Global;
|
|
using JetBrains.Annotations;
|
|
using UnityEngine;
|
|
using UnityEngine.Scripting;
|
|
|
|
namespace Fruitomation.Game
|
|
{
|
|
public class PresserBuilding : Building
|
|
{
|
|
[Header("Presser Specific Buildings")]
|
|
[SerializeField] private Animator PresserAnimator;
|
|
[SerializeField] private Collider2D TopCollider;
|
|
[SerializeField] private Collider2D BottomCollider;
|
|
|
|
private void Update()
|
|
{
|
|
if (GameStateController.Is(GameState.Simulation))
|
|
{
|
|
if (PresserAnimator.speed == 0)
|
|
{
|
|
PresserAnimator.Play(0, 0, 0f); // Play from beginning
|
|
PresserAnimator.speed = 0.2f; // Playing
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
if (PresserAnimator.speed != 0)
|
|
{
|
|
PresserAnimator.Play(0, 0, 0f); // Jump back to default frame
|
|
PresserAnimator.speed = 0; // Paused
|
|
}
|
|
}
|
|
}
|
|
|
|
[Preserve, UsedImplicitly] public void OpenTop() => TopCollider.enabled = false;
|
|
[Preserve, UsedImplicitly] public void CloseTop() => TopCollider.enabled = true;
|
|
|
|
[Preserve, UsedImplicitly] public void OpenBottom() => BottomCollider.enabled = false;
|
|
[Preserve, UsedImplicitly] public void CloseBottom() => BottomCollider.enabled = true;
|
|
|
|
[Preserve, UsedImplicitly] public void Press()
|
|
{
|
|
Debug.Log("Presser Press");
|
|
}
|
|
}
|
|
} |