Refactored Anne Lise bush into state machine
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Pixelplacement;
|
||||
|
||||
public class AnneLiseBushPopBehaviour : MonoBehaviour
|
||||
@@ -9,6 +10,12 @@ public class AnneLiseBushPopBehaviour : MonoBehaviour
|
||||
public float popDelay = 0f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(BushPeak());
|
||||
|
||||
}
|
||||
|
||||
void PopOutOfBush()
|
||||
{
|
||||
// Example: Move bushObject along the spline from start (0) to end (1)
|
||||
Tween.Spline(
|
||||
@@ -20,7 +27,30 @@ public class AnneLiseBushPopBehaviour : MonoBehaviour
|
||||
popDuration,
|
||||
popDelay,
|
||||
Tween.EaseInOut,
|
||||
Tween.LoopType.PingPong
|
||||
Tween.LoopType.None
|
||||
);
|
||||
}
|
||||
|
||||
void HideInBush()
|
||||
{
|
||||
// Example: Move bushObject along the spline from start (0) to end (1)
|
||||
Tween.Spline(
|
||||
popSpline,
|
||||
bushObject,
|
||||
0f,
|
||||
1f,
|
||||
false, // Do not orient to path
|
||||
popDuration,
|
||||
popDelay,
|
||||
Tween.EaseInOut,
|
||||
Tween.LoopType.None
|
||||
);
|
||||
}
|
||||
|
||||
IEnumerator BushPeak()
|
||||
{
|
||||
PopOutOfBush();
|
||||
yield return new WaitForSeconds(5);
|
||||
HideInBush();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user