Fixed pantsless worker anims
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user