这部分主要讲解关于CineMachine组件的使用,制作触发动画
CinematicTrigger:
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Playables;
-
- namespace RPG.Cinematics
- {
- //相机动画触发
- public class CinematicTrigger:MonoBehaviour
- {
- private void OnTriggerEnter(Collider other)//触发碰撞后
- {
- GetComponent<PlayableDirector>().Play();//获取导演组件,开始播放
- GetComponent<BoxCollider>().enabled = false;//将碰撞体隐藏,玩家只能触发一次动画序列
- }
- }
- }
-
复制代码
|