chicken_dy/Assets/Scripts/Game/Film.cs

29 lines
630 B
C#
Raw Normal View History

2022-02-09 08:35:01 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Film : MonoBehaviour
{
private Animator mAni;
private void Start()
{
mAni = GetComponentInChildren<Animator>();
PlayScene("0");
}
public void PlayScene(string pSceneCode)
{
2022-02-14 12:28:14 +00:00
if (mAni == null)
return;
2022-02-15 04:58:53 +00:00
if (!mAni.HasState(0, Animator.StringToHash(pSceneCode)))//兼容1-1-2这种
{
string tNewCode = pSceneCode.Replace("_", "-");
mAni.Play(tNewCode);
}
else
{
mAni.Play(pSceneCode);
}
2022-02-09 08:35:01 +00:00
}
}