| 123456789101112131415161718192021222324252627282930313233 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class StudentAnimator : MonoBehaviour
- {
- public GameObject cameraSet;
- public Animator animator;
- [Header("开始播放视角移向学生")]
- public bool startCamera = true;
- [Header("结束播放视角移向黑板")]
- public bool endCamera = true;
- private void OnEnable()
- {
- if (startCamera)
- {
- cameraSet.transform.localPosition = new Vector3(0, 1.2f, 6);
- cameraSet.transform.localEulerAngles = new Vector3(0, 180, 0);
- }
- animator.SetBool("IsPlay", true);
- }
- private void OnDisable()
- {
- if (endCamera)
- {
- cameraSet.transform.localPosition = new Vector3(0, 1.2f, 0);
- cameraSet.transform.localEulerAngles = new Vector3(0, 0, 0);
- }
- animator.SetBool("IsPlay", true);
- }
- }
|