Merge branch 'main' into DamianBranch

This commit is contained in:
2025-12-15 02:08:19 +01:00
2925 changed files with 280043 additions and 3779 deletions

View File

@@ -0,0 +1,41 @@
using UnityEngine;
using Core;
using Core.Lifecycle;
using UnityEngine.Playables;
using Input;
using Unity.Cinemachine;
public class LevelIntroDirector : ManagedBehaviour
{
public bool playOnSceneReady;
[HideInInspector]
public PlayableDirector introPlayableDirector;
internal override void OnSceneReady()
{
base.OnSceneReady();
if (playOnSceneReady)
{
introPlayableDirector = GetComponent<PlayableDirector>();
introPlayableDirector.stopped += IntroTimelineStopped;
PlayIntroTimeline();
}
else { gameObject.SetActive(false); }
}
private void IntroTimelineStopped(PlayableDirector director)
{
InputManager.Instance.SetInputMode(InputMode.Game);
introPlayableDirector.stopped -= IntroTimelineStopped;
gameObject.SetActive(false);
}
public void PlayIntroTimeline()
{
introPlayableDirector.Play();
InputManager.Instance.SetInputMode(InputMode.InputDisabled);
}
}

View File

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

View File

@@ -19,7 +19,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &68470730839161369
Transform:
m_ObjectHideFlags: 0
@@ -282,6 +282,7 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &6407014757843176454
MonoBehaviour:
@@ -541,6 +542,7 @@ Animator:
m_WriteDefaultValuesOnDisable: 0
--- !u!212 &2397974294601466633
SpriteRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
@@ -586,6 +588,7 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_Sprite: {fileID: -8189809603051793254, guid: 64965726962afa94b88cefeb179bc573, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@@ -595,7 +598,6 @@ SpriteRenderer:
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &2882415700974115882
GameObject:
@@ -1049,6 +1051,7 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &7793638615220209122
MonoBehaviour:
@@ -1183,6 +1186,7 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &9040376305951000489
MonoBehaviour:
@@ -1288,6 +1292,7 @@ SkinnedMeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
serializedVersion: 2
m_Quality: 0
m_UpdateWhenOffscreen: 0
@@ -1407,6 +1412,7 @@ SkinnedMeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
serializedVersion: 2
m_Quality: 0
m_UpdateWhenOffscreen: 0
@@ -1585,6 +1591,7 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &4362079983360807751
MonoBehaviour:
@@ -1598,6 +1605,92 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5980d28f81eb545d78e1d84e1449a10f, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &7663727731875931215
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 106062057957134378}
m_Modifications:
- target: {fileID: 1852608221241404454, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 1487011052474782424, guid: f489e2c9ce64ff34aa3c7a91a4edbd77, type: 3}
- target: {fileID: 4322425255501872291, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_Name
value: GlowOutline
objectReference: {fileID: 0}
- target: {fileID: 5094223041467069679, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 1487011052474782424, guid: f489e2c9ce64ff34aa3c7a91a4edbd77, type: 3}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5692747743727126428, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 1487011052474782424, guid: f489e2c9ce64ff34aa3c7a91a4edbd77, type: 3}
- target: {fileID: 6093743105869044773, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 1487011052474782424, guid: f489e2c9ce64ff34aa3c7a91a4edbd77, type: 3}
- target: {fileID: 6900224008763310802, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: itemSprite
value:
objectReference: {fileID: 3156508682930277421}
- target: {fileID: 6900224008763310802, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
propertyPath: interactionType
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
--- !u!4 &2480480958425800128 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5203759348480833935, guid: 231f994d50ad2cc42a9d03a39e45c4ff, type: 3}
m_PrefabInstance: {fileID: 7663727731875931215}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7984152337586070562
PrefabInstance:
m_ObjectHideFlags: 0
@@ -1716,7 +1809,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4940025602237181209, guid: 60fd8777c3180dd40be2d9e3ff56dd2c, type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4972892989515032591, guid: 60fd8777c3180dd40be2d9e3ff56dd2c, type: 3}
propertyPath: m_Sprite
@@ -1784,6 +1877,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 8049523385480426504, guid: 60fd8777c3180dd40be2d9e3ff56dd2c, type: 3}
insertIndex: 0
addedObject: {fileID: 2901638171899200938}
- targetCorrespondingSourceObject: {fileID: 8049523385480426504, guid: 60fd8777c3180dd40be2d9e3ff56dd2c, type: 3}
insertIndex: -1
addedObject: {fileID: 2480480958425800128}
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 4940025602237181209, guid: 60fd8777c3180dd40be2d9e3ff56dd2c, type: 3}
insertIndex: -1
@@ -1811,6 +1907,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 95e46aacea5b42888ee7881894193c11, type: 3}
m_Name:
m_EditorClassIdentifier: AppleHillsScripts::Core.SaveLoad.SaveableState
--- !u!212 &3156508682930277421 stripped
SpriteRenderer:
m_CorrespondingSourceObject: {fileID: 4972892989515032591, guid: 60fd8777c3180dd40be2d9e3ff56dd2c, type: 3}
m_PrefabInstance: {fileID: 7984152337586070562}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &8911052060583241195
PrefabInstance:
m_ObjectHideFlags: 0

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

@@ -1,20 +1,28 @@
using System;
using AppleHills;
using System.Collections.Generic;
using UnityEngine;
using Core.Lifecycle;
using JetBrains.Annotations;
public class GlowOutline : MonoBehaviour
public class GlowOutline : ManagedBehaviour
{
private SpriteRenderer parentSprite;
private SpriteRenderer outlineSprite;
public float scaleFactor;
public GlowOutlineData[] outlineModes;
private Color outlineColor;
private Transform[] childrenTransforms;
private SpriteRenderer[] childrenSprites;
private List<GlowOutlineData> outlineColors;
private void OnEnable()
public SpriteRenderer itemSprite;
public float thiccness;
public GlowOutlineData.InteractionType interactionType;
public bool animatedSprite;
public Material outlineMaterial;
internal override void OnManagedStart()
{
SetupOutline();
}
@@ -22,12 +30,81 @@ public class GlowOutline : MonoBehaviour
private void SetupOutline()
{
parentSprite = GetComponentInParent<SpriteRenderer>();
outlineSprite = GetComponent<SpriteRenderer>();
// Get references to item sprite, own sprite and the outline settings from Interaction Settings
outlineColors = SettingsAccess.GetInteractionOutlineColors();
outlineSprite.sprite = parentSprite.sprite;
gameObject.transform.localScale = gameObject.transform.localScale * scaleFactor;
//outlineSprite.color = outlineColour;
// Get the transforms and spriterenderers of children
childrenTransforms = GetComponentsInChildren<Transform>();
childrenSprites = GetComponentsInChildren<SpriteRenderer>();
// Set the color to use in this outline from the colors set in Interaction Settings
foreach (GlowOutlineData data in outlineColors)
{
if (data.interaction == interactionType)
{
outlineColor = data.outlineColour;
}
}
// Set the scale and sprite of each child. Skip first child because that's the outline object.
childrenTransforms[1].localPosition = new Vector3(1, 0, 0) * thiccness;
childrenTransforms[2].localPosition = new Vector3(-1, 0, 0) * thiccness;
childrenTransforms[3].localPosition = new Vector3(0, 1, 0) * thiccness;
childrenTransforms[4].localPosition = new Vector3(0, -1, 0) * thiccness;
foreach (SpriteRenderer childSprite in childrenSprites)
{
if (itemSprite.sprite != null)
{
childSprite.sprite = itemSprite.sprite;
childSprite.material = outlineMaterial;
}
if (childSprite.sharedMaterial != null)
{
childSprite.sharedMaterial.color = outlineColor;
}
if (itemSprite == null)
{
Debug.Log($"Outline {name} is missing an item sprite!");
}
}
}
public void Update()
{
if (animatedSprite)
{
foreach (SpriteRenderer childSprite in childrenSprites)
{
if (itemSprite.sprite != null)
{
childSprite.sprite = itemSprite.sprite;
}
}
}
}
#if UNITY_EDITOR
// Update outline in editor
private void OnValidate()
{
SetupOutline();
}
#endif
}

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

@@ -9,6 +9,6 @@ public class MachineWorkingBehavior : MonoBehaviour
public void WorkingAnimationDone()
{
stateMachine.ChangeState("Exploding");
//stateMachine.ChangeState("Exploding");
}
}

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

View File

@@ -20,6 +20,15 @@ namespace StateMachines.Quarry.AnneLise
{
dialogueCanvas?.SetActive(false);
_anneLiseBushStateMachine.ChangeState("TakePhoto");
foreach (GlowOutline outline in GetComponentsInChildren<GlowOutline>())
{
if (outline != null)
{
outline.gameObject.SetActive(false);
}
}
}
}
}