Files
AppleHillsProduction/Assets/Scripts/StateMachines/Quarry/AnneLise/TakePhotoState.cs

56 lines
1.5 KiB
C#
Raw Normal View History

using Input;
2025-10-09 16:38:27 +02:00
using Pixelplacement;
using System.Collections;
using UnityEngine;
using UnityEngine.Events;
using static Input.PlayerTouchController;
public class TakePhotoState : State
{
public Transform playerTargetObject;
private GameObject playerCharacter;
private PlayerTouchController playerTouchController;
2025-10-09 16:38:27 +02:00
private Vector3 newPlayerPosition;
private
// 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>();
2025-10-09 16:38:27 +02:00
playerTouchController.OnArrivedAtTarget += PlayerHasArrived;
newPlayerPosition = new Vector3(playerTargetObject.transform.position.x, playerTargetObject.transform.position.y, playerTargetObject.transform.position.z);
//playerTouchController.InterruptMoveTo();
playerTouchController.MoveToAndNotify(newPlayerPosition);
InputManager.Instance.SetInputMode(InputMode.InputDisabled);
}
// When the player has arrived at the bush do Animator.SetTrigger(Takephoto) and whatevs
public void PhotoTaken()
{
ChangeState("Hidden");
InputManager.Instance.SetInputMode(InputMode.Game);
}
void PlayerHasArrived()
{
GetComponent<Animator>().SetTrigger("TakePhoto");
playerTouchController.OnArrivedAtTarget += null;
}
}