Files
Fruitomation/Assets/Scripts/Game/Buildings/Automation/PresserBuilding.cs
2026-04-21 22:44:44 +01:00

69 lines
1.8 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()
{
Debug.Log(nameof(OpenTop));
TopCollider.enabled = false;
}
[Preserve, UsedImplicitly]
public void CloseTop()
{
Debug.Log(nameof(CloseTop));
TopCollider.enabled = true;
}
[Preserve, UsedImplicitly]
public void OpenBottom()
{
Debug.Log(nameof(OpenBottom));
BottomCollider.enabled = false;
}
[Preserve, UsedImplicitly]
public void CloseBottom()
{
Debug.Log(nameof(CloseBottom));
BottomCollider.enabled = true;
}
[Preserve, UsedImplicitly] public void Press()
{
Debug.Log("Presser Press");
}
}
}