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();
}
}

View File

@@ -13,6 +13,7 @@ public class WorkerBeltReturningBehaviour : AppleState
public GameObject roamingWorker;
public GameObject workerBeltObject;
public Animator workerAnimator;
public RuntimeAnimatorController pantslessController;
private TweenBase returnTween;
public AppleMachine workerBeltStateMAchineRef;
public Transform StartingAnchor;
@@ -20,6 +21,9 @@ public class WorkerBeltReturningBehaviour : AppleState
private void OnEnable()
{
workerAnimator.runtimeAnimatorController = pantslessController;
workerAnimator.SetBool("pantsDown?", true);
if (roamingWorker != null)
roamingWorker.SetActive(true);
@@ -67,7 +71,6 @@ public class WorkerBeltReturningBehaviour : AppleState
// callback implementations
void HandleReturnStarted()
{
// optional: play audio/anim etc.
}
void HandleReturnFinished()

View File

@@ -17,6 +17,7 @@ public class GlowOutline : ManagedBehaviour
public float thiccness;
public GlowOutlineData.InteractionType interactionType;
public bool animatedSprite;
public Material outlineMaterial;
@@ -35,7 +36,6 @@ public class GlowOutline : ManagedBehaviour
// Get the transforms and spriterenderers of children
childrenTransforms = GetComponentsInChildren<Transform>();
childrenSprites = GetComponentsInChildren<SpriteRenderer>();
// childrenMaterials = GetComponentsInChildren<Material>();
// Set the color to use in this outline from the colors set in Interaction Settings
foreach (GlowOutlineData data in outlineColors)
@@ -59,6 +59,7 @@ public class GlowOutline : ManagedBehaviour
if (itemSprite.sprite != null)
{
childSprite.sprite = itemSprite.sprite;
childSprite.material = outlineMaterial;
}
if (childSprite.sharedMaterial != null)

View File

@@ -0,0 +1,32 @@
using Core.SaveLoad;
using UnityEngine;
public class BeltSnatchBehaviour : MonoBehaviour
{
public GameObject beltObject;
public AppleMachine stateMachine;
public Animator walkingWorkerAnimator;
private Animator beltWorkerAnimator;
public void OnEnable()
{
beltWorkerAnimator = GetComponent<Animator>();
}
public void EnableBeltInteraction()
{
beltObject.SetActive(true);
}
public void TransitionToReturnState()
{
stateMachine.ChangeState("WorkerReturning");
}
public void BeltSnatched()
{
beltWorkerAnimator.SetBool("beltSnatched?", true);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b744b8758f070614b976c431633925cb

View File

@@ -9,6 +9,7 @@ public class CookieEatingBehavior : AppleState
{
public SpriteRenderer cookieEatingSprites;
public SpriteRenderer consumedCookieSprites;
public GameObject cookieOutline;
private PlayableDirector cookieEatingDirector;
private SpriteRenderer playerSprites;
@@ -21,6 +22,7 @@ public class CookieEatingBehavior : AppleState
cookieEatingDirector = GetComponentInChildren<PlayableDirector>();
playerSprites.enabled = false;
consumedCookieSprites.enabled = false;
cookieOutline.SetActive(false);
cookieEatingDirector.enabled = true;
InputManager.Instance.SetInputMode(InputMode.InputDisabled);

View File

@@ -0,0 +1,17 @@
using UnityEngine;
public class RoamingWorkerAnimationEvents : MonoBehaviour
{
public WorkerBeltRoamingBehaviour roamingBehaviour;
public void WorkerGotUp()
{
roamingBehaviour.ContinueRoaming();
}
public void PauseTween()
{
roamingBehaviour.PauseRoaming();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a7c2bc850a85b1843bc20fd916d10650