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,54 @@
|
||||
using Pixelplacement;
|
||||
using UnityEngine;
|
||||
using Core.SaveLoad;
|
||||
|
||||
public class ButterFlyBehaviour : MonoBehaviour
|
||||
{
|
||||
public AppleMachine butterStateMachine;
|
||||
public Spline butterflightSpline;
|
||||
public Transform butterflyObject;
|
||||
public float flightDuration = 2f;
|
||||
public float flightDelay = 0f;
|
||||
|
||||
private const float AnchorThreshold = 0.05f;
|
||||
private Animator butterflyAnimator;
|
||||
|
||||
// Called when entering the butterfly flight state
|
||||
public void OnEnable()
|
||||
{
|
||||
if (butterflightSpline == null || butterflyObject == null)
|
||||
{
|
||||
Debug.LogWarning("ButterFlyBehaviour: Missing spline or butterfly object reference.");
|
||||
return;
|
||||
}
|
||||
if (butterflyObject != null )
|
||||
{
|
||||
butterflyAnimator = butterflyObject.GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
butterflyAnimator.SetTrigger("BrokeOut");
|
||||
GetComponent<AppleAudioSource>().Play(0);
|
||||
|
||||
Tween.Spline(
|
||||
butterflightSpline,
|
||||
butterflyObject,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
flightDuration,
|
||||
flightDelay,
|
||||
Tween.EaseInOut,
|
||||
Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished
|
||||
);
|
||||
}
|
||||
public void HandleTweenStarted()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void HandleTweenFinished()
|
||||
{
|
||||
butterStateMachine.ChangeState("Free");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user