Merge branch 'main' into DamianBranch

This commit is contained in:
2025-11-04 17:57:49 +00:00
5 changed files with 46 additions and 15 deletions

View File

@@ -492,7 +492,7 @@ MonoBehaviour:
m_Value: m_Value:
_contentType: 1 _contentType: 1
_text: _text:
_image: {fileID: -5941552768301239376, guid: 300528d856c15824989bade57a7e04e4, type: 3} _image: {fileID: -8203946286166492161, guid: 6cb19dd8ad625c543abe9aa233cd676d, type: 3}
_audio: {fileID: 8300000, guid: 69b3ae7103725d843b45b91cd31c0a4a, type: 3} _audio: {fileID: 8300000, guid: 69b3ae7103725d843b45b91cd31c0a4a, type: 3}
- rid: 4008004961314799901 - rid: 4008004961314799901
type: {class: 'Constant`1[[System.Boolean, mscorlib]]', ns: Unity.GraphToolkit.Editor, asm: Unity.GraphToolkit.Internal.Editor} type: {class: 'Constant`1[[System.Boolean, mscorlib]]', ns: Unity.GraphToolkit.Editor, asm: Unity.GraphToolkit.Internal.Editor}
@@ -504,7 +504,7 @@ MonoBehaviour:
m_Value: m_Value:
_contentType: 1 _contentType: 1
_text: _text:
_image: {fileID: -5941552768301239376, guid: 300528d856c15824989bade57a7e04e4, type: 3} _image: {fileID: -8203946286166492161, guid: 6cb19dd8ad625c543abe9aa233cd676d, type: 3}
_audio: {fileID: 8300000, guid: 9cd155aba23b8ca4394ea3ecec4a0792, type: 3} _audio: {fileID: 8300000, guid: 9cd155aba23b8ca4394ea3ecec4a0792, type: 3}
- rid: 4008004961314799903 - rid: 4008004961314799903
type: {class: 'Constant`1[[System.Boolean, mscorlib]]', ns: Unity.GraphToolkit.Editor, asm: Unity.GraphToolkit.Internal.Editor} type: {class: 'Constant`1[[System.Boolean, mscorlib]]', ns: Unity.GraphToolkit.Editor, asm: Unity.GraphToolkit.Internal.Editor}

View File

@@ -410,6 +410,7 @@ MonoBehaviour:
normalOrthoSize: 15 normalOrthoSize: 15
transitionDuration: 0.5 transitionDuration: 0.5
flyingBehaviour: {fileID: 1790656766} flyingBehaviour: {fileID: 1790656766}
takeOffBehaviour: {fileID: 1252594312}
birdStateMachine: {fileID: 368957769} birdStateMachine: {fileID: 368957769}
--- !u!4 &12163667 --- !u!4 &12163667
Transform: Transform:
@@ -449614,11 +449615,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8361739881193827101, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3} - target: {fileID: 8361739881193827101, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 7.439999 value: 7.4399986
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8361739881193827101, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3} - target: {fileID: 8361739881193827101, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 11.47 value: 11.469999
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 9074453772172382270, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3} - target: {fileID: 9074453772172382270, guid: 4b7426bc1f8736749b68973653f4dbfb, type: 3}
propertyPath: chaseSpline propertyPath: chaseSpline
@@ -452548,6 +452549,7 @@ MonoBehaviour:
SoundBirdObject: {fileID: 277331775} SoundBirdObject: {fileID: 277331775}
flightDuration: 3 flightDuration: 3
flightDelay: 0.46 flightDelay: 0.46
flyingBehaviour: {fileID: 1790656766}
audioSource: {fileID: 368957773} audioSource: {fileID: 368957773}
--- !u!1001 &1256486233 --- !u!1001 &1256486233
PrefabInstance: PrefabInstance:
@@ -470680,6 +470682,10 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: AnneLiseBushA value: AnneLiseBushA
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7775613298932159589, guid: fc42c3bdda1c86d49b0bf80c28e5d372, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7775613298932159589, guid: fc42c3bdda1c86d49b0bf80c28e5d372, type: 3} - target: {fileID: 7775613298932159589, guid: fc42c3bdda1c86d49b0bf80c28e5d372, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 54.84 value: 54.84
@@ -471062,6 +471068,10 @@ PrefabInstance:
propertyPath: birdGameStats propertyPath: birdGameStats
value: value:
objectReference: {fileID: 708284665} objectReference: {fileID: 708284665}
- target: {fileID: 4380364850094877018, guid: f15bf96f88d21b14191ad80200912775, type: 3}
propertyPath: reactionClipToPlay
value:
objectReference: {fileID: 8300000, guid: 2419f718f73907749a2940ac09d65238, type: 3}
- target: {fileID: 6843886318979936936, guid: f15bf96f88d21b14191ad80200912775, type: 3} - target: {fileID: 6843886318979936936, guid: f15bf96f88d21b14191ad80200912775, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -27.09 value: -27.09
@@ -471623,6 +471633,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 123989455} m_TransformParent: {fileID: 123989455}
m_Modifications: m_Modifications:
- target: {fileID: 160486722158287766, guid: 3fa494ec083cbe54a86c3a1b107a90c0, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 160486722158287766, guid: 3fa494ec083cbe54a86c3a1b107a90c0, type: 3} - target: {fileID: 160486722158287766, guid: 3fa494ec083cbe54a86c3a1b107a90c0, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -71.04 value: -71.04
@@ -472151,6 +472165,7 @@ SceneRoots:
- {fileID: 965792696} - {fileID: 965792696}
- {fileID: 764788851} - {fileID: 764788851}
- {fileID: 7638743433705074736} - {fileID: 7638743433705074736}
- {fileID: 1640143969}
- {fileID: 2926576032425091693} - {fileID: 2926576032425091693}
- {fileID: 2056506545} - {fileID: 2056506545}
- {fileID: 2115320175} - {fileID: 2115320175}
@@ -472171,4 +472186,3 @@ SceneRoots:
- {fileID: 1374202465} - {fileID: 1374202465}
- {fileID: 519077570} - {fileID: 519077570}
- {fileID: 708284666} - {fileID: 708284666}
- {fileID: 1640143969}

View File

@@ -11,6 +11,7 @@ public class cameraSwitcher : MonoBehaviour
[SerializeField] private float normalOrthoSize = 20f; [SerializeField] private float normalOrthoSize = 20f;
[SerializeField] private float transitionDuration = 0.5f; // Duration of the transition [SerializeField] private float transitionDuration = 0.5f; // Duration of the transition
[SerializeField] private soundBird_FlyingBehaviour flyingBehaviour; [SerializeField] private soundBird_FlyingBehaviour flyingBehaviour;
[SerializeField] private soundBird_TakeOffBehaviour takeOffBehaviour; // New reference
[SerializeField] private StateMachine birdStateMachine; [SerializeField] private StateMachine birdStateMachine;
private int playerInsideCount = 0; private int playerInsideCount = 0;
@@ -38,12 +39,16 @@ public class cameraSwitcher : MonoBehaviour
{ {
if (zoomCoroutine != null) StopCoroutine(zoomCoroutine); if (zoomCoroutine != null) StopCoroutine(zoomCoroutine);
zoomCoroutine = StartCoroutine(SmoothOrthoSize(virtualCamera, normalOrthoSize, transitionDuration)); zoomCoroutine = StartCoroutine(SmoothOrthoSize(virtualCamera, normalOrthoSize, transitionDuration));
// Fix: Check if currentState's name is "SoundBirdFlyAround" and flyingBehaviour is not null if (birdStateMachine.currentState != null)
if (birdStateMachine.currentState != null &&
birdStateMachine.currentState.name == "SoundBirdFlyAround" &&
flyingBehaviour != null)
{ {
flyingBehaviour.StartLanding(); if (birdStateMachine.currentState.name == "SoundBirdFlyAround" && flyingBehaviour != null)
{
flyingBehaviour.StartLanding();
}
else if (birdStateMachine.currentState.name == "SoundBirdTakeoff" && takeOffBehaviour != null)
{
takeOffBehaviour.StartLanding();
}
} }
} }
} }

View File

@@ -12,6 +12,7 @@ public class soundBird_TakeOffBehaviour : MonoBehaviour
private StateMachine stateMachine; private StateMachine stateMachine;
private Animator animator; private Animator animator;
private TweenBase objectTween; private TweenBase objectTween;
public soundBird_FlyingBehaviour flyingBehaviour;
public AppleAudioSource audioSource; public AppleAudioSource audioSource;
@@ -48,4 +49,19 @@ public class soundBird_TakeOffBehaviour : MonoBehaviour
stateMachine.ChangeState("SoundBirdFlyAround"); // Change to the desired state name stateMachine.ChangeState("SoundBirdFlyAround"); // Change to the desired state name
} }
} }
// Added for cameraSwitcher
public void StartLanding()
{
if (objectTween != null)
{
objectTween.Cancel();
}
if (stateMachine != null)
{
flyingBehaviour.midFlightPosition = SoundBirdObject.position;
stateMachine.ChangeState("SoundBirdLanding");
}
}
} }

View File

@@ -19,7 +19,7 @@ public class AppleAudioSource : MonoBehaviour
public int sourcePriority; public int sourcePriority;
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
void Start() void OnEnable()
{ {
audioSource = GetComponent<AudioSource>(); audioSource = GetComponent<AudioSource>();
AudioManager.Instance.RegisterNewAudioSource(this); AudioManager.Instance.RegisterNewAudioSource(this);
@@ -29,10 +29,6 @@ public class AppleAudioSource : MonoBehaviour
} }
private void Awake()
{
Start();
}
public void InitializeAudioSource() public void InitializeAudioSource()
{ {