Fixed SoundBird Bug
This commit is contained in:
@@ -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:
|
||||||
@@ -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:
|
||||||
@@ -472163,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}
|
||||||
@@ -472183,4 +472186,3 @@ SceneRoots:
|
|||||||
- {fileID: 1374202465}
|
- {fileID: 1374202465}
|
||||||
- {fileID: 519077570}
|
- {fileID: 519077570}
|
||||||
- {fileID: 708284666}
|
- {fileID: 708284666}
|
||||||
- {fileID: 1640143969}
|
|
||||||
|
|||||||
@@ -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,13 +39,17 @@ 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" &&
|
if (birdStateMachine.currentState.name == "SoundBirdFlyAround" && flyingBehaviour != null)
|
||||||
flyingBehaviour != null)
|
|
||||||
{
|
{
|
||||||
flyingBehaviour.StartLanding();
|
flyingBehaviour.StartLanding();
|
||||||
}
|
}
|
||||||
|
else if (birdStateMachine.currentState.name == "SoundBirdTakeoff" && takeOffBehaviour != null)
|
||||||
|
{
|
||||||
|
takeOffBehaviour.StartLanding();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user