StudentAnimator.cs 885 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class StudentAnimator : MonoBehaviour
  5. {
  6. public GameObject cameraSet;
  7. public Animator animator;
  8. [Header("开始播放视角移向学生")]
  9. public bool startCamera = true;
  10. [Header("结束播放视角移向黑板")]
  11. public bool endCamera = true;
  12. private void OnEnable()
  13. {
  14. if (startCamera)
  15. {
  16. cameraSet.transform.localPosition = new Vector3(0, 1.2f, 6);
  17. cameraSet.transform.localEulerAngles = new Vector3(0, 180, 0);
  18. }
  19. animator.SetBool("IsPlay", true);
  20. }
  21. private void OnDisable()
  22. {
  23. if (endCamera)
  24. {
  25. cameraSet.transform.localPosition = new Vector3(0, 1.2f, 0);
  26. cameraSet.transform.localEulerAngles = new Vector3(0, 0, 0);
  27. }
  28. animator.SetBool("IsPlay", true);
  29. }
  30. }
粤ICP备19079148号