Files
AppleHillsProduction/Assets/Scripts/Animation/BirdEyesBehavior.cs
2025-11-05 20:37:17 +01:00

45 lines
1.1 KiB
C#

using Core.SaveLoad;
using UnityEngine;
using Pixelplacement;
public class BirdEyesBehavior : MonoBehaviour
{
private AppleMachine statemachine;
private Animator animator;
public bool correctItemIsIn;
[SerializeField] private Animator bushAnimator; // Assign in Inspector
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
statemachine = GetComponent<AppleMachine>();
animator = GetComponentInChildren<Animator>();
}
public void CorrectItem()
{
correctItemIsIn = true;
animator.SetTrigger("RightGuess");
BirdReveal();
}
public void IncorrectItem()
{
correctItemIsIn = false;
animator.SetTrigger("WrongGuess");
}
public void NoItem()
{
animator.SetTrigger("NoGuess");
}
public void BirdReveal()
{
if (bushAnimator != null)
{
bushAnimator.SetTrigger("wolterisout");
statemachine.ChangeState("BirdSpawned");
return;
}
statemachine.ChangeState ("BirdSpawned");
}
}