Added anim placeholders for the worker belt animation

This commit is contained in:
2025-12-03 04:22:26 +01:00
parent fa6af89a62
commit 1b8c180425
30 changed files with 5292 additions and 57 deletions

View File

@@ -0,0 +1,69 @@
using Core.SaveLoad;
using UnityEngine;
using Pixelplacement;
using Pixelplacement.TweenSystem;
public class WorkerBeltApproachingBehaviour : AppleState
{
public Spline ApproachingSpline;
public Transform workerObjectTransform;
public float approachduration;
public float approachDelay;
//References to the Worker Gameobject
public GameObject workerBeltObject;
public Animator workerAnimator;
public WorkerBeltRoamingBehaviour workerBeltRoamingRef;
private TweenBase aproachTween;
public AppleMachine workerBeltStateMAchineRef;
private void OnEnable()
{
Transform anchorB = transform.Find("AnchorA");
if (anchorB != null)
{
anchorB.position = workerBeltRoamingRef.midRoamPosition;
}
Debug.Log("Entered Worker Belt Approaching State");
if (ApproachingSpline == null || workerObjectTransform == null)
{
Debug.LogWarning("WorkerBeltApproachingBehaviour: ApproachingSpline or workerObjectTransform is not assigned.", this);
return;
}
// Start the tween to move the worker along the approaching spline
aproachTween = Tween.Spline(
ApproachingSpline,
workerObjectTransform,
0, 1,
false,
approachduration,
approachDelay,
Tween.EaseLinear,
Tween.LoopType.None,
HandleApproachStarted, // optional
HandleApproachFinished // called when spline completes
);
}
private void OnDisable()
{
Debug.Log("Exited Worker Belt Approaching State");
}
// callback implementations
void HandleApproachStarted()
{
// optional: play audio/anim etc.
}
void HandleApproachFinished()
{
Debug.Log("Approach tween finished");
// cleanup
aproachTween?.Stop();
workerAnimator.SetBool("isLifting?", true);
workerBeltStateMAchineRef.ChangeState(2);
}
}