Flying Bird Puzzle section Complete.
Finished with the logic of the flying bird step.
This commit is contained in:
@@ -131,6 +131,9 @@ MonoBehaviour:
|
||||
m_PrefilterNativeRenderPass: 1
|
||||
m_PrefilterUseLegacyLightmaps: 0
|
||||
m_PrefilterBicubicLightmapSampling: 1
|
||||
m_PrefilterReflectionProbeBlending: 1
|
||||
m_PrefilterReflectionProbeBoxProjection: 1
|
||||
m_PrefilterReflectionProbeAtlas: 1
|
||||
m_ShaderVariantLogLevel: 0
|
||||
m_ShadowCascades: 0
|
||||
m_Textures:
|
||||
|
||||
1
Assets/Resources/PerformanceTestRunInfo.json
Normal file
1
Assets/Resources/PerformanceTestRunInfo.json
Normal file
@@ -0,0 +1 @@
|
||||
{"TestSuite":"","Date":0,"Player":{"Development":false,"ScreenWidth":0,"ScreenHeight":0,"ScreenRefreshRate":0,"Fullscreen":false,"Vsync":0,"AntiAliasing":0,"Batchmode":false,"RenderThreadingMode":"MultiThreaded","GpuSkinning":false,"Platform":"","ColorSpace":"","AnisotropicFiltering":"","BlendWeights":"","GraphicsApi":"","ScriptingBackend":"IL2CPP","AndroidTargetSdkVersion":"AndroidApiLevelAuto","AndroidBuildSystem":"Gradle","BuildTarget":"Android","StereoRenderingPath":"MultiPass"},"Hardware":{"OperatingSystem":"","DeviceModel":"","DeviceName":"","ProcessorType":"","ProcessorCount":0,"GraphicsDeviceName":"","SystemMemorySizeMB":0},"Editor":{"Version":"6000.2.6f1","Branch":"6000.2/staging","Changeset":"cc51a95c0300","Date":1758053328},"Dependencies":["com.unity.2d.sprite@1.0.0","com.unity.2d.spriteshape@12.0.1","com.unity.addressables@2.7.3","com.unity.addressables.android@1.0.7","com.unity.cinemachine@3.1.4","com.unity.feature.2d@2.0.1","com.unity.film-internal-utilities@0.18.4-preview","com.unity.graphtoolkit@0.4.0-exp.2","com.unity.ide.rider@3.0.38","com.unity.ide.visualstudio@2.0.23","com.unity.inputsystem@1.14.2","com.unity.multiplayer.center@1.0.0","com.unity.render-pipelines.universal@17.2.0","com.unity.timeline@1.8.9","com.unity.ugui@2.0.0","com.unity.modules.accessibility@1.0.0","com.unity.modules.ai@1.0.0","com.unity.modules.androidjni@1.0.0","com.unity.modules.animation@1.0.0","com.unity.modules.assetbundle@1.0.0","com.unity.modules.audio@1.0.0","com.unity.modules.cloth@1.0.0","com.unity.modules.director@1.0.0","com.unity.modules.imageconversion@1.0.0","com.unity.modules.imgui@1.0.0","com.unity.modules.jsonserialize@1.0.0","com.unity.modules.particlesystem@1.0.0","com.unity.modules.physics@1.0.0","com.unity.modules.physics2d@1.0.0","com.unity.modules.screencapture@1.0.0","com.unity.modules.terrain@1.0.0","com.unity.modules.terrainphysics@1.0.0","com.unity.modules.tilemap@1.0.0","com.unity.modules.ui@1.0.0","com.unity.modules.uielements@1.0.0","com.unity.modules.umbra@1.0.0","com.unity.modules.unityanalytics@1.0.0","com.unity.modules.unitywebrequest@1.0.0","com.unity.modules.unitywebrequestassetbundle@1.0.0","com.unity.modules.unitywebrequestaudio@1.0.0","com.unity.modules.unitywebrequesttexture@1.0.0","com.unity.modules.unitywebrequestwww@1.0.0","com.unity.modules.vehicles@1.0.0","com.unity.modules.video@1.0.0","com.unity.modules.vr@1.0.0","com.unity.modules.wind@1.0.0","com.unity.modules.xr@1.0.0","com.unity.modules.subsystems@1.0.0","com.unity.modules.hierarchycore@1.0.0","com.unity.render-pipelines.core@17.2.0","com.unity.shadergraph@17.2.0","com.unity.render-pipelines.universal-config@17.0.3","com.unity.test-framework@1.6.0","com.unity.ext.nunit@2.0.5","com.unity.2d.animation@12.0.2","com.unity.2d.pixel-perfect@5.1.0","com.unity.2d.psdimporter@11.0.1","com.unity.2d.tilemap@1.0.0","com.unity.2d.tilemap.extras@5.0.1","com.unity.2d.aseprite@2.0.1","com.unity.splines@2.8.2","com.unity.profiling.core@1.0.2","com.unity.scriptablebuildpipeline@2.4.2","com.unity.2d.common@11.0.1","com.unity.mathematics@1.3.2","com.unity.searcher@4.9.3","com.unity.burst@1.8.24","com.unity.collections@2.5.7","com.unity.rendering.light-transport@1.0.1","com.unity.settings-manager@2.1.0","com.unity.nuget.mono-cecil@1.11.5","com.unity.test-framework.performance@3.1.0"],"Results":[]}
|
||||
7
Assets/Resources/PerformanceTestRunInfo.json.meta
Normal file
7
Assets/Resources/PerformanceTestRunInfo.json.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30eed45b70c64f149a8c41413586dc59
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1
Assets/Resources/PerformanceTestRunSettings.json
Normal file
1
Assets/Resources/PerformanceTestRunSettings.json
Normal file
@@ -0,0 +1 @@
|
||||
{"MeasurementCount":-1}
|
||||
7
Assets/Resources/PerformanceTestRunSettings.json.meta
Normal file
7
Assets/Resources/PerformanceTestRunSettings.json.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 107805368f625f14e8084b92dd89e78b
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ public class SoundGenerator : MonoBehaviour
|
||||
[SerializeField] private AudioClip enterSound;
|
||||
[SerializeField] private AudioSource audioSource;
|
||||
[SerializeField] private StateMachine soundBirdSMRef;
|
||||
[SerializeField] private soundBird_CanFly soundbirdHearingCheck;
|
||||
|
||||
private bool playerInside = false;
|
||||
private SpriteRenderer spriteRenderer;
|
||||
@@ -35,12 +36,11 @@ public class SoundGenerator : MonoBehaviour
|
||||
{
|
||||
audioSource.PlayOneShot(enterSound);
|
||||
}
|
||||
if (soundBirdSMRef != null && soundBirdSMRef.currentState.name == "SoundBird")
|
||||
if (soundBirdSMRef != null && soundBirdSMRef.currentState.name == "SoundBird" && soundbirdHearingCheck.canFly == true)
|
||||
{
|
||||
soundBirdSMRef.ChangeState("SoundBirdTakeoff"); // Replace with your actual method/state
|
||||
soundBirdSMRef.ChangeState("SoundBirdTakeoff");
|
||||
|
||||
}
|
||||
// Play sound and change animation/state here if needed
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ public class SoundGenerator : MonoBehaviour
|
||||
{
|
||||
spriteRenderer.sprite = exitSprite;
|
||||
}
|
||||
// Reset animation/state here if needed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,31 @@
|
||||
using UnityEngine;
|
||||
using Unity.Cinemachine;
|
||||
using System.Collections;
|
||||
using Pixelplacement;
|
||||
|
||||
public class cameraSwitcher : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private CinemachineCamera virtualCamera;
|
||||
[SerializeField] private float zoomedFOV = 30f;
|
||||
[SerializeField] private float normalFOV = 40f;
|
||||
[SerializeField] private Vector3 zoomedOffset = new Vector3(0, 2, -10);
|
||||
[SerializeField] private Vector3 normalOffset = new Vector3(0, 5, -10);
|
||||
[SerializeField] private CinemachineConfiner2D confiner2D;
|
||||
[SerializeField] private float zoomOutOrthoSize = 27f;
|
||||
[SerializeField] private float normalOrthoSize = 20f;
|
||||
[SerializeField] private float transitionDuration = 0.5f; // Duration of the transition
|
||||
[SerializeField] private soundBird_FlyingBehaviour flyingBehaviour;
|
||||
[SerializeField] private StateMachine birdStateMachine;
|
||||
|
||||
private int playerInsideCount = 0;
|
||||
//private CinemachineTransposer transposer;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
/* if (virtualCamera != null)
|
||||
{
|
||||
transposer = virtualCamera.GetCinemachineComponent<CinemachineTransposer>();
|
||||
}*/
|
||||
}
|
||||
private Coroutine zoomCoroutine;
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
playerInsideCount++;
|
||||
/*if (playerInsideCount == 1 && virtualCamera != null)
|
||||
if (playerInsideCount == 1 && virtualCamera != null)
|
||||
{
|
||||
// Adjust FOV
|
||||
virtualCamera.m_Lens.FieldOfView = zoomedFOV;
|
||||
// Adjust follow distance (offset)
|
||||
if (transposer != null)
|
||||
transposer.m_FollowOffset = zoomedOffset;
|
||||
}*/
|
||||
if (zoomCoroutine != null) StopCoroutine(zoomCoroutine);
|
||||
zoomCoroutine = StartCoroutine(SmoothOrthoSize(virtualCamera, zoomOutOrthoSize, transitionDuration));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +34,35 @@ public class cameraSwitcher : MonoBehaviour
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
playerInsideCount--;
|
||||
/*if (playerInsideCount == 0 && virtualCamera != null)
|
||||
if (playerInsideCount == 0 && virtualCamera != null)
|
||||
{
|
||||
// Restore FOV
|
||||
virtualCamera.m_Lens.FieldOfView = normalFOV;
|
||||
// Restore follow distance (offset)
|
||||
if (transposer != null)
|
||||
transposer.m_FollowOffset = normalOffset;
|
||||
}*/
|
||||
if (zoomCoroutine != null) StopCoroutine(zoomCoroutine);
|
||||
zoomCoroutine = StartCoroutine(SmoothOrthoSize(virtualCamera, normalOrthoSize, transitionDuration));
|
||||
// Fix: Check if currentState's name is "SoundBirdFlyAround" and flyingBehaviour is not null
|
||||
if (birdStateMachine.currentState != null &&
|
||||
birdStateMachine.currentState.name == "SoundBirdFlyAround" &&
|
||||
flyingBehaviour != null)
|
||||
{
|
||||
flyingBehaviour.StartLanding();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator SmoothOrthoSize(CinemachineCamera cam, float targetSize, float duration)
|
||||
{
|
||||
float startSize = cam.Lens.OrthographicSize;
|
||||
float elapsed = 0f;
|
||||
while (elapsed < duration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
cam.Lens.OrthographicSize = Mathf.Lerp(startSize, targetSize, elapsed / duration);
|
||||
yield return null;
|
||||
}
|
||||
cam.Lens.OrthographicSize = targetSize;
|
||||
if (confiner2D != null)
|
||||
{
|
||||
confiner2D.InvalidateBoundingShapeCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class soundBird_CanFly : MonoBehaviour
|
||||
{
|
||||
public bool canFly = true;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void birdCanHear(bool canhear)
|
||||
{
|
||||
if (canhear)
|
||||
{
|
||||
canFly = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
canFly = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6a41511eddc628479b46152f9042034
|
||||
@@ -13,7 +13,7 @@ public class soundBird_FlyingBehaviour : MonoBehaviour
|
||||
private StateMachine stateMachine;
|
||||
private Animator animator;
|
||||
private TweenBase objectTween;
|
||||
private Coroutine cooldownCoroutine;
|
||||
//private Coroutine cooldownCoroutine;
|
||||
public Vector3 midFlightPosition;
|
||||
|
||||
private float lastX;
|
||||
@@ -28,7 +28,7 @@ public class soundBird_FlyingBehaviour : MonoBehaviour
|
||||
private void OnEnable()
|
||||
{
|
||||
objectTween = Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseLinear, Tween.LoopType.Loop, HandleTweenStarted, HandleTweenFinished);
|
||||
cooldownCoroutine = StartCoroutine(CooldownTimer());
|
||||
//cooldownCoroutine = StartCoroutine(CooldownTimer());
|
||||
lastX = SoundBirdObject.position.x;
|
||||
}
|
||||
|
||||
@@ -59,12 +59,22 @@ public class soundBird_FlyingBehaviour : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
private System.Collections.IEnumerator CooldownTimer()
|
||||
/*private System.Collections.IEnumerator CooldownTimer()
|
||||
{
|
||||
yield return new WaitForSeconds(cooldownTime);
|
||||
midFlightPosition = SoundBirdObject.position;
|
||||
objectTween.Cancel();
|
||||
stateMachine.ChangeState("SoundBirdLanding");
|
||||
}*/
|
||||
|
||||
public void StartLanding()
|
||||
{
|
||||
midFlightPosition = SoundBirdObject.position;
|
||||
if (objectTween != null)
|
||||
{
|
||||
objectTween.Cancel();
|
||||
}
|
||||
stateMachine.ChangeState("SoundBirdLanding");
|
||||
}
|
||||
|
||||
void HandleTweenStarted() { }
|
||||
|
||||
@@ -29,7 +29,7 @@ public class soundBird_LandingBehaviour1 : MonoBehaviour
|
||||
{
|
||||
anchorB.position = flyingBehaviour.midFlightPosition;
|
||||
}
|
||||
objectTween = Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseLinear, Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished);
|
||||
objectTween = Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseOut, Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished);
|
||||
|
||||
// Initialize lastX for flipping logic
|
||||
if (SoundBirdObject != null)
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
using Pixelplacement;
|
||||
using UnityEngine;
|
||||
|
||||
public class soundBird_Spooked_FlyBehaviour : MonoBehaviour
|
||||
{
|
||||
public Spline FlightSpline;
|
||||
public Transform SoundBirdObject;
|
||||
public float flightDuration;
|
||||
public float flightDelay;
|
||||
[Range(0, 1)] public float startPercentage;
|
||||
|
||||
private StateMachine stateMachine;
|
||||
private Animator animator;
|
||||
[SerializeField] private State stateRef;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
stateMachine = GetComponentInParent<StateMachine>();
|
||||
animator = GetComponentInParent<Animator>();
|
||||
stateRef = GetComponent<State>();
|
||||
}
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
//initiateTweenSpline();
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseLinear, Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished);
|
||||
}
|
||||
|
||||
void HandleTweenStarted()
|
||||
{
|
||||
|
||||
}
|
||||
void HandleTweenFinished()
|
||||
{
|
||||
if (SoundBirdObject != null)
|
||||
{
|
||||
//Tween.Stop(SoundBirdObject.GetInstanceID(), Tween.TweenType.Spline); // Stop the spline tween for this object
|
||||
}
|
||||
//Debug.Log("Tween finished!");
|
||||
if (stateMachine != null)
|
||||
{
|
||||
//stateMachine.ChangeState("SoundBird"); // Change to the desired state name
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10bb74c0e6993ea428971e8ae0b07ed9
|
||||
@@ -25,7 +25,7 @@ public class soundBird_TakeOffBehaviour : MonoBehaviour
|
||||
private void OnEnable()
|
||||
{
|
||||
animator.SetBool("isScared", true);
|
||||
objectTween = Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseLinear, Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished);
|
||||
objectTween = Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseIn, Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished);
|
||||
}
|
||||
void HandleTweenStarted()
|
||||
{
|
||||
|
||||
@@ -86,6 +86,7 @@ PlayerSettings:
|
||||
muteOtherAudioSources: 0
|
||||
Prepare IOS For Recording: 0
|
||||
Force IOS Speakers When Recording: 0
|
||||
audioSpatialExperience: 0
|
||||
deferSystemGesturesMode: 0
|
||||
hideHomeButton: 0
|
||||
submitAnalytics: 1
|
||||
@@ -132,6 +133,7 @@ PlayerSettings:
|
||||
switchNVNMaxPublicSamplerIDCount: 0
|
||||
switchMaxWorkerMultiple: 8
|
||||
switchNVNGraphicsFirmwareMemory: 32
|
||||
switchGraphicsJobsSyncAfterKick: 1
|
||||
vulkanNumSwapchainBuffers: 3
|
||||
vulkanEnableSetSRGBWrite: 0
|
||||
vulkanEnablePreTransform: 0
|
||||
@@ -275,6 +277,9 @@ PlayerSettings:
|
||||
AndroidBuildApkPerCpuArchitecture: 0
|
||||
AndroidTVCompatibility: 0
|
||||
AndroidIsGame: 1
|
||||
androidAppCategory: 3
|
||||
useAndroidAppCategory: 1
|
||||
androidAppCategoryOther:
|
||||
AndroidEnableTango: 0
|
||||
androidEnableBanner: 1
|
||||
androidUseLowAccuracyLocation: 0
|
||||
|
||||
Reference in New Issue
Block a user