2025-10-08 15:47:36 +02:00
|
|
|
using Input;
|
2025-10-09 16:38:27 +02:00
|
|
|
using Pixelplacement;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Events;
|
|
|
|
|
using static Input.PlayerTouchController;
|
2025-10-08 15:47:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2025-10-08 15:47:36 +02:00
|
|
|
|
|
|
|
|
// 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;
|
2025-10-08 15:47:36 +02:00
|
|
|
}
|
|
|
|
|
}
|