Redid the SoundBird Logic of flight
changed the flight of the bird to be able to have more control over the takeoff, loops and landing.
This commit is contained in:
@@ -10,10 +10,14 @@ public class soundBird_Spooked_FlyBehaviour : MonoBehaviour
|
||||
[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
|
||||
@@ -21,27 +25,25 @@ public class soundBird_Spooked_FlyBehaviour : MonoBehaviour
|
||||
{
|
||||
//initiateTweenSpline();
|
||||
}
|
||||
|
||||
public void initiateTweenSpline()
|
||||
private void OnEnable()
|
||||
{
|
||||
Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseLinear, Tween.LoopType.Loop, HandleTweenStarted, HandleTweenFinished);
|
||||
Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseLinear, Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished);
|
||||
}
|
||||
|
||||
void HandleTweenStarted()
|
||||
{
|
||||
|
||||
//Debug.Log("Tween started!");
|
||||
// You can add any additional logic here if needed when the tween starts
|
||||
|
||||
}
|
||||
void HandleTweenFinished()
|
||||
{
|
||||
if (SoundBirdObject != null)
|
||||
{
|
||||
Tween.Stop(SoundBirdObject.GetInstanceID(), Tween.TweenType.Spline); // Stop the spline tween for this object
|
||||
//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
|
||||
//stateMachine.ChangeState("SoundBird"); // Change to the desired state name
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user