1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
- using UnityEngine;
- namespace Animancer.Examples.AnimatorControllers
- {
-
-
-
-
- [AddComponentMenu(Strings.ExamplesMenuPrefix + "Animator Controllers - Hybrid Basics")]
- [HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(AnimatorControllers) + "/" + nameof(HybridBasics))]
- public sealed class HybridBasics : MonoBehaviour
- {
-
- [SerializeField] private AnimancerComponent _Animancer;
- [SerializeField] private AnimationClip _SeparateAnimation;
-
- private void Awake()
- {
-
- OptionalWarning.NativeControllerHumanoid.Disable();
- }
-
- private static readonly int MoveParameterID = Animator.StringToHash("Move");
-
- public void SetMove(bool move)
- {
-
- if (_Animancer is HybridAnimancerComponent hybrid)
- hybrid.SetBool(MoveParameterID, move);
- else
- _Animancer.Animator.SetBool(MoveParameterID, move);
- }
-
-
- public void PlaySeparateAnimation()
- {
- _Animancer.Play(_SeparateAnimation);
- }
-
-
- public void PlayAnimatorController()
- {
-
- if (_Animancer is HybridAnimancerComponent hybrid)
- hybrid.Play(hybrid.Controller, 0);
- else
- _Animancer.Stop();
- }
-
-
- public void FadeSeparateAnimation()
- {
- _Animancer.Play(_SeparateAnimation, 0.25f);
- }
-
-
- public void FadeAnimatorController()
- {
-
- if (_Animancer is HybridAnimancerComponent hybrid)
- hybrid.PlayController();
- else
- _Animancer.Layers[0].StartFade(0, 0.25f);
- }
-
- }
- }
|