public void OverrideAnimationClip(string path) { if (_animationPath == path) { return; } _animationPath = path; if (_animationClipProxy != null) { _animationClipProxy.UnloadProxy(); } _animationClipProxy = ResourceMgr.singleton.LoadAssetAsync(path); _animationClipProxy.AddLoadFinishCallBack(() => { var clip = _animationClipProxy.GetUnityAsset <AnimationClip>(); if (Machine.AnimatorOverrideController && clip) { Machine.AnimatorOverrideController[StateName] = clip; Machine.Animator.runtimeAnimatorController = Machine.AnimatorOverrideController; //_animator.Rebind(); _animationClip = clip; } }); }
public void Initialize(Animator animator, string path) { _animator = animator; _runtimeAnimatorProxy = ResourceMgr.singleton.LoadAssetAsync(path); _runtimeAnimatorProxy.AddLoadFinishCallBack(() => { var ctrl = _runtimeAnimatorProxy.GetUnityAsset <RuntimeAnimatorController>(); if (ctrl) { _animator.runtimeAnimatorController = ctrl; _animatorOverrideController = new AnimatorOverrideController(ctrl); _animator.Rebind(); } }); }
public void Init(Animator animator, string path) { _animator = animator; _runtimeAnimatorProxy = ResourceMgr.Instance.LoadAssetAsync(path); _runtimeAnimatorProxy.AddLoadFinishCallBack(() => { RuntimeAnimatorController ctrl = _runtimeAnimatorProxy.GetUnityAsset <RuntimeAnimatorController>(); if (ctrl) { _animator.runtimeAnimatorController = ctrl; _animatorOverrideController = ctrl as AnimatorOverrideController; _animator.Rebind(); } }); }
private void OnLoadFinish() { if (_proxy == null) { _texture = _proxy.GetUnityAsset <Texture>(); if (_texture == null) { _proxy.UnloadProxy(); Deprecated = true; } } if (!Deprecated) { } }
public void Initialize() { if (null == Entity) { return; } Animator = Entity.Animator; _runtimeAnimatorProxy = ResourceMgr.singleton.LoadAssetAsync(AssetPath); _runtimeAnimatorProxy.AddLoadFinishCallBack(() => { var ctrl = _runtimeAnimatorProxy.GetUnityAsset <RuntimeAnimatorController>(); if (ctrl) { AnimatorOverrideController = new AnimatorOverrideController(ctrl); Animator.runtimeAnimatorController = AnimatorOverrideController; Animator.Rebind(); Enable = true; TransToDefault(); //TODO foreach (var state in StateList) { var str = string.Empty; if (state.StateName == StateNameEnum.Idle.ToString()) { str = "Animation/Skeleton/Idle.anim"; } if (state.StateName == StateNameEnum.Move.ToString()) { str = "Animation/Skeleton/Run.anim"; } if (state.StateName == StateNameEnum.Skill.ToString()) { str = "Animation/Skeleton/Attack.anim"; } if (state.StateName == StateNameEnum.Special.ToString()) { str = "Animation/Skeleton/Damage.anim"; } if (state.StateName == StateNameEnum.Dead.ToString()) { str = "Animation/Skeleton/Death.anim"; } state.Initialize(str); } } }); }
public void OverrideAnimationClip(string name, string path, bool autoPlay = true) { _animationClipProxy = ResourceMgr.Instance.LoadAssetAsync(path); _animationClipProxy.AddLoadFinishCallBack(() => { AnimationClip clip = _animationClipProxy.GetUnityAsset <AnimationClip>(); if (_animatorOverrideController && clip) { _animatorOverrideController[name] = clip; _animator.runtimeAnimatorController = _animatorOverrideController; _AnimationInfo.Data[name] = clip; _animator.Rebind(); if (autoPlay) { _animator.Play(name); } } }); }
public void Initialize() { if (null == Entity) { return; } Animator = Entity.Animator; _runtimeAnimatorProxy = ResourceMgr.singleton.LoadAssetAsync(AssetPath); _runtimeAnimatorProxy.AddLoadFinishCallBack(() => { RuntimeAnimatorController ctrl = _runtimeAnimatorProxy.GetUnityAsset <RuntimeAnimatorController>(); if (ctrl) { Animator.runtimeAnimatorController = ctrl; AnimatorOverrideController = new AnimatorOverrideController(ctrl); Animator.Rebind(); Enable = true; TransToDefault(); } }); }