Fixed pantsless worker anims

This commit is contained in:
journaliciouz
2025-12-13 18:16:49 +01:00
parent a83e4e7cef
commit dd7eeea6db
27 changed files with 1659 additions and 110 deletions

View File

@@ -3,6 +3,7 @@ using UnityEngine;
using Pixelplacement;
using Pixelplacement.TweenSystem;
using System.Collections;
using System.Runtime.CompilerServices;
public class WorkerBeltRoamingBehaviour : AppleState
{
@@ -22,7 +23,8 @@ public class WorkerBeltRoamingBehaviour : AppleState
// Reference to the active spline tween so we can pause/stop it
private TweenBase roamingTween;
void OnEnable()
{
if (workerAnimator != null)
@@ -39,6 +41,12 @@ public class WorkerBeltRoamingBehaviour : AppleState
// Store the returned TweenBase so we can control it later
roamingTween = Tween.Spline(RoamingSpline, workerObjectTransform, 0, 1, false, roamDuration, roamDelay, Tween.EaseLinear, Tween.LoopType.Loop);
pantsLess = true;
if (workerAnimator.GetBool("pantsDown?"))
{
pantsLess = true;
}
if (pantsLess)
{
pantsRoutine = StartCoroutine(RandomFallChance());
@@ -85,10 +93,11 @@ public class WorkerBeltRoamingBehaviour : AppleState
public void CheckForFall()
{
// 5% chance to fall each check
if (Random.value < 0.05f)
// 50% chance to fall each check
if (Random.value < 0.42f)
{
workerAnimator?.SetTrigger("shouldFall?");
}
}
@@ -101,4 +110,15 @@ public class WorkerBeltRoamingBehaviour : AppleState
}
}
public void ContinueRoaming()
{
roamingTween.Resume();
}
public void PauseRoaming()
{
roamingTween.Stop();
}
}