1
This commit is contained in:
@@ -130,6 +130,15 @@ public class MonsterContral : MonoBehaviour
|
||||
/// <summary>冰冻特效(预制体内子物体,null 则跳过)</summary>
|
||||
public GameObject bingDongEffect;
|
||||
|
||||
[Header("创建视频(可选)")]
|
||||
[Tooltip("鱼创建时播放的入场视频片段,播放结束后才开始移动。为空则无入场视频。播放控件由 GameMainPanel_FishBase 提供")]
|
||||
public UnityEngine.Video.VideoClip createVideoClip;
|
||||
/// <summary>createVideoClip 实际播放时长(秒),用于计算 moveTime 偏移。<=0 表示未播放/无视频</summary>
|
||||
protected float _createVideoDuration = 0f;
|
||||
|
||||
/// <summary>当前是否正在播放创建视频(由外部播放器 isPlaying 判断)</summary>
|
||||
protected bool _isPlayingCreateVideo = false;
|
||||
|
||||
/// <summary>是否存活(活跃且未被回收)</summary>
|
||||
public bool IsAlive => gameObject.activeInHierarchy;
|
||||
|
||||
@@ -170,6 +179,10 @@ public class MonsterContral : MonoBehaviour
|
||||
uirootRect = UIManager.Instance.uiRoot.GetComponent<RectTransform>();
|
||||
mainCamera = Camera.main;
|
||||
moveTime = 0f;
|
||||
// ⭐ 重置创建视频状态:池回收的鱼 _isPlayingCreateVideo 可能残留 true,
|
||||
// 重新生成时重置,由 Init 决定是否重新播放
|
||||
_createVideoDuration = 0f;
|
||||
_isPlayingCreateVideo = false;
|
||||
InitAnimList();
|
||||
ChangeState(CharacterStateType.move);
|
||||
|
||||
@@ -254,6 +267,11 @@ public class MonsterContral : MonoBehaviour
|
||||
if (!isMove)
|
||||
transform.position = Vector3.zero;
|
||||
|
||||
// ⭐ 创建视频启动逻辑由子类负责:
|
||||
// - MonsterControl_BossBase 在自己 Init 里启动 createVideo
|
||||
// - 普通鱼走父类 Init,但普通鱼一般不配 createVideo
|
||||
// OnMoveUpdata 会检测 createVideo.isPlaying,视频播放期间不移动
|
||||
|
||||
// 路径结束后自动销毁
|
||||
//StartCoroutine(yanchi(gameObject, time, isyuzhen));
|
||||
}
|
||||
@@ -319,6 +337,16 @@ public class MonsterContral : MonoBehaviour
|
||||
public virtual void OnMoveUpdata()
|
||||
{
|
||||
if (!isMove) return; // 冰冻中不计时
|
||||
|
||||
// ⭐ 创建视频播放期间不移动、不累计 moveTime
|
||||
// 视频结束后才开始走路线;视频时长不计入 moveTime(单独累计到 _createVideoDuration)
|
||||
// 隐藏控件由 loopPointReached 回调负责(OnCreateVideoFinished)
|
||||
if (_isPlayingCreateVideo)
|
||||
{
|
||||
_createVideoDuration += Time.deltaTime;
|
||||
return;
|
||||
}
|
||||
|
||||
moveTime += Time.deltaTime;
|
||||
|
||||
if (isyz)
|
||||
|
||||
Reference in New Issue
Block a user