using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; using Sirenix.OdinInspector; namespace Beyond { public class DeerController : MonoBehaviour { private Material material; [SerializeField] private new Renderer renderer; private string colorString = "_BaseColor"; public float movementDuration = 9f; public Animator deer; private void Start() { } [Button] public void ShowDeer() { deer.gameObject.SetActive(true); material = renderer.material; material.DOFade(0.5f, colorString, 2f); deer.SetBool("walking", true); deer.SetBool("idle", false); StartCoroutine(HideDeerCoroutine()); } private IEnumerator HideDeerCoroutine() { yield return new WaitForSeconds(movementDuration); material.DOFade(0f, colorString, 2f); yield return new WaitForSeconds(2f); DisableDeer(); } public void DisableDeer() { transform.parent.gameObject.SetActive(false); } private void OnDrawGizmosSelected() { Gizmos.color = Color.red; Gizmos.DrawLine(transform.position, (transform.position + transform.forward * movementDuration)); } } }