Refactored Anne Lise bush into state machine

This commit is contained in:
2025-10-08 15:47:36 +02:00
parent a5fab5ba86
commit 92f935f272
17 changed files with 1866 additions and 568 deletions

View File

@@ -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();
}
}

View File

@@ -177,7 +177,7 @@ namespace Input
/// <summary>
/// Moves the player directly towards the specified world position.
/// </summary>
private void MoveDirectlyTo(Vector2 worldPosition)
public void MoveDirectlyTo(Vector2 worldPosition)
{
if (aiPath == null)
{

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 46f20ad63b7cd12478628ddb21d94b61
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2895eee2a24e2844ab10dc87b3e33484
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3e0a697e48a761e40b145475cfb6e210
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
using UnityEngine;
using Pixelplacement;
public class AnneLiseBushBehaviour : MonoBehaviour
{
private StateMachine anneLiseBushStateMachine;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
anneLiseBushStateMachine = GetComponent<StateMachine>();
}
// Update is called once per frame
void Update()
{
}
void TakePhoto()
{
anneLiseBushStateMachine.ChangeState("TakePhoto");
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 603ecc4a6ab6bb84c8cb9773fa310b69

View File

@@ -0,0 +1,33 @@
using UnityEngine;
using System.Collections;
using Pixelplacement;
using Input;
public class TakePhotoState : State
{
public Transform playerTargetObject;
private GameObject playerCharacter;
private PlayerTouchController playerTouchController;
private Vector2 newPlayerPosition;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnEnable()
{
playerCharacter = GameObject.FindWithTag("Player");
playerTouchController = playerCharacter.GetComponent<PlayerTouchController>();
newPlayerPosition = new Vector2(playerCharacter.transform.position.x, playerCharacter.transform.position.y);
playerTouchController.MoveDirectlyTo(newPlayerPosition);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 260954bde403f504c84c67f22b8a5888