| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using Sirenix.OdinInspector;
- using System.Collections;
- using System.Collections.Generic;
- using UnityCommon;
- using UnityEngine;
- namespace DTYJ
- {
- public class DianFuTiCtrl : SerializedMonoBehaviour
- {
- public static DianFuTiCtrl Instance;
- private void Awake()
- {
- Instance = this;
- }
- public Dictionary<string, Animation> dic;
- public void SetState(string id, int state)
- {
- if (dic.ContainsKey(id))
- {
- var anim = dic[id];//.GetComponent<Animation>();
- var animationName = anim.clip.name;
- //anim[animationName].time = state == 1 ? 0 : anim[animationName].length;
- switch (state)
- {
- case 0:
- anim[animationName].speed = 1;
- break;
- case 1:
- anim[animationName].speed = -1;
- break;
- case 2:
- case 3:
- anim[animationName].speed = 0;
- break;
- }
- anim[animationName].wrapMode = WrapMode.Loop;
- anim.CrossFade(animationName);
- }
- }
- [ContextMenu("´¦Àí")]
- public void HandleTemp()
- {
- Dictionary<string, Animation> dicNew = new Dictionary<string, Animation>();
- foreach (var kvp in dic)
- {
- var animPath = Utility.GetPathInHierichy(kvp.Value.transform, null);
- dicNew["1_" + kvp.Key] = GameObject.Find("StationOthers/1/" + animPath).GetComponent<Animation>();
- dicNew["2_" + kvp.Key] = GameObject.Find("StationOthers/2/" + animPath).GetComponent<Animation>();
- }
- foreach (var kvp in dicNew)
- {
- dic[kvp.Key] = kvp.Value;
- }
- }
- }
- }
|