29 lines
		
	
	
		
			630 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			630 B
		
	
	
	
		
			C#
		
	
	
	
| 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)
 | |
|     {
 | |
|         if (mAni == null)
 | |
|             return;
 | |
| 
 | |
|         if (!mAni.HasState(0, Animator.StringToHash(pSceneCode)))//兼容1-1-2这种
 | |
|         {
 | |
|             string tNewCode = pSceneCode.Replace("_", "-");
 | |
|             mAni.Play(tNewCode);
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             mAni.Play(pSceneCode);
 | |
|         }
 | |
|     }
 | |
| } |