I have a player that will give a sitting patient a pill and then he will stand for 60 seconds. I cannot get the patient to stand. I tried using a IEnumerator coroutine and even tried accessing the Animator component in the script. Everything else works like giving me a message that the patient has been saved but he still stays sitting on the ground. Please help.
Here is my patient script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PatientMove : MonoBehaviour
{
private Animator patient;
void Start()
{
patient = GetComponent<Animator>();
patient.Play("Idle_SittingOnGround");
}
public IEnumerator TreatPatient()
{
Animator patient;
patient = GetComponent<Animator>();
patient.Play("Idle");
yield return new WaitForSeconds(60);
patient.Play("Idle_SittingOnGround");
}
}
Here is my player script:
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.CompareTag("Business Man") && hasPill)
{
hasPill = false;
pillVaccine.SetActive(false);
patientSaved++;
textScore.text = "Patients: " + patientSaved;
GameObject.FindWithTag("Business Man").GetComponent<Animator>().Play("Idle");
//StartCoroutine(GameObject.FindWithTag("Business Man").GetComponent<PatientMove>().TreatPatient());
}