Disabled Saves, moved Folders adn renamed Data files, and added a state machine to the cookie puzzle
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using Core.SaveLoad;
|
||||
using Pixelplacement;
|
||||
using Pixelplacement.TweenSystem;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class soundBird_TakeOffBehaviour : MonoBehaviour
|
||||
{
|
||||
public Spline FlightSpline;
|
||||
public Transform SoundBirdObject;
|
||||
public float flightDuration;
|
||||
public float flightDelay;
|
||||
private AppleMachine stateMachine;
|
||||
private Animator animator;
|
||||
private TweenBase objectTween;
|
||||
public soundBird_FlyingBehaviour flyingBehaviour;
|
||||
|
||||
public AppleAudioSource audioSource;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
stateMachine = GetComponentInParent<AppleMachine>();
|
||||
animator = GetComponentInParent<Animator>();
|
||||
}
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
//initiateTweenSpline();
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
animator.SetBool("isScared", true);
|
||||
objectTween = Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseIn, Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished);
|
||||
audioSource.Play(0);
|
||||
}
|
||||
void HandleTweenStarted()
|
||||
{
|
||||
|
||||
}
|
||||
void HandleTweenFinished()
|
||||
{
|
||||
if (SoundBirdObject != null)
|
||||
{
|
||||
objectTween.Cancel(); // Stop the spline tween for this object
|
||||
|
||||
}
|
||||
//Logging.Debug("Tween finished!");
|
||||
if (stateMachine != null)
|
||||
{
|
||||
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