add animation tool

This commit is contained in:
VDH
2025-09-16 18:07:13 +07:00
parent 6e3ecada59
commit a9aa67cc2d
906 changed files with 581456 additions and 5 deletions
Binary file not shown.
@@ -25,10 +25,8 @@ namespace PerfectWorld.Scripts.Managers
public int HandlerId => (int)MANAGER_INDEX.MAN_PLAYER;
public bool ProcessMessage(ECMSG Msg)
{
Debug.LogWarning("HoangDev : EC_ManPlayerProcessMessage");
if (Msg.iSubID == 0)
{
Debug.LogWarning("HoangDev : EC_ManPlayerEC_ManPlayerEC_ManPlayer");
if (GameController.Instance == null) return true;
GameController.Instance.GetHostPlayer().ProcessMessage(Msg);
}
@@ -38,7 +36,6 @@ namespace PerfectWorld.Scripts.Managers
{
case int value when value == EC_MsgDef.MSG_PM_PLAYERINFO:
{
Debug.Log(" EC_MsgDef.MSG_PM_PLAYERINFO");
OnMsgPlayerInfo(Msg);
break;
}
@@ -63,7 +60,6 @@ namespace PerfectWorld.Scripts.Managers
public void OnMsgPlayerInfo(ECMSG Msg)
{
Debug.LogWarning("OnMsgPlayerInfo ");
int iHostID = Convert.ToInt32(Msg.dwParam3);
int lenghtByte = Marshal.SizeOf<int>();
byte[] byteArray = new byte[lenghtByte];
@@ -226,7 +222,6 @@ namespace PerfectWorld.Scripts.Managers
public bool HostPlayerInfo1(cmd_self_info_1 info)
{
Debug.Log("HostPlayerInfo1");
//bool isDoneWorldRender = false;
//bool isDoneNPCRender = false;
//Action actLoadChar = () =>
@@ -3,6 +3,7 @@ using CSNetwork;
using CSNetwork.Protocols;
using CSNetwork.Protocols.RPCData;
using CSNetwork.Security;
using ModelRenderer.Scripts.Common;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -119,6 +120,7 @@ namespace BrewMonster.Network
}
public static void SendChatData(byte cChannel, in string szMsg, int iPack, int iSlot)
{
Instance._gameSession.SendChatData(cChannel, szMsg, iPack, iSlot);
}
public static void RequestInventoryAsync(byte byPackage, Action callback = null)
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 47358e702f82b724888a00aaf152e456
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,3 @@
{
"name": "Animancer"
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4c25c05f410a3a447a75c3b0909152ef
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,727 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
namespace Animancer
{
/// <summary>
/// The main component through which other scripts can interact with <see cref="Animancer"/>. It allows you to play
/// animations on an <see cref="UnityEngine.Animator"/> without using a <see cref="RuntimeAnimatorController"/>.
/// </summary>
/// <remarks>
/// This class can be used as a custom yield instruction to wait until all animations finish playing.
/// <para></para>
/// This class is mostly just a wrapper that connects an <see cref="AnimancerPlayable"/> to an
/// <see cref="UnityEngine.Animator"/>.
/// <para></para>
/// Documentation: <see href="https://kybernetik.com.au/animancer/docs/manual/playing/component-types">Component Types</see>
/// </remarks>
/// https://kybernetik.com.au/animancer/api/Animancer/AnimancerComponent
///
[AddComponentMenu(Strings.MenuPrefix + "Animancer Component")]
[HelpURL(Strings.DocsURLs.APIDocumentation + "/" + nameof(AnimancerComponent))]
[DefaultExecutionOrder(DefaultExecutionOrder)]
public class AnimancerComponent : MonoBehaviour,
IAnimancerComponent, IEnumerator, IAnimationClipSource, IAnimationClipCollection
{
/************************************************************************************************************************/
#region Fields and Properties
/************************************************************************************************************************/
/// <summary>Initialize before anything else tries to use this component.</summary>
public const int DefaultExecutionOrder = -5000;
/************************************************************************************************************************/
[SerializeField, Tooltip("The Animator component which this script controls")]
private Animator _Animator;
/// <summary>[<see cref="SerializeField"/>]
/// The <see cref="UnityEngine.Animator"/> component which this script controls.
/// </summary>
public Animator Animator
{
get => _Animator;
set
{
_Animator = value;
if (IsPlayableInitialized)
{
_Playable.DestroyOutput();
_Playable.CreateOutput(value, this);
}
}
}
#if UNITY_EDITOR
/// <summary>[Editor-Only] The name of the serialized backing field for the <see cref="Animator"/> property.</summary>
string IAnimancerComponent.AnimatorFieldName => nameof(_Animator);
#endif
/************************************************************************************************************************/
private AnimancerPlayable _Playable;
/// <summary>
/// The internal system which manages the playing animations.
/// Accessing this property will automatically initialize it.
/// </summary>
public AnimancerPlayable Playable
{
get
{
InitializePlayable();
return _Playable;
}
}
/// <summary>Indicates whether the <see cref="Playable"/> has been initialized.</summary>
public bool IsPlayableInitialized => _Playable != null && _Playable.IsValid;
/************************************************************************************************************************/
/// <summary>The states managed by this component.</summary>
public AnimancerPlayable.StateDictionary States => Playable.States;
/// <summary>The layers which each manage their own set of animations.</summary>
public AnimancerPlayable.LayerList Layers => Playable.Layers;
/// <summary>Returns the <see cref="Playable"/>.</summary>
public static implicit operator AnimancerPlayable(AnimancerComponent animancer) => animancer.Playable;
/// <summary>Returns layer 0.</summary>
public static implicit operator AnimancerLayer(AnimancerComponent animancer) => animancer.Playable.Layers[0];
/************************************************************************************************************************/
[SerializeField, Tooltip("Determines what happens when this component is disabled" +
" or its " + nameof(GameObject) + " becomes inactive (i.e. in " + nameof(OnDisable) + "):" +
"\n• " + nameof(DisableAction.Stop) + " all animations" +
"\n• " + nameof(DisableAction.Pause) + " all animations" +
"\n• " + nameof(DisableAction.Continue) + " playing" +
"\n• " + nameof(DisableAction.Reset) + " to the original values" +
"\n• " + nameof(DisableAction.Destroy) + " all layers and states")]
private DisableAction _ActionOnDisable;
#if UNITY_EDITOR
/// <summary>[Editor-Only] The name of the serialized backing field for the <see cref="ActionOnDisable"/> property.</summary>
string IAnimancerComponent.ActionOnDisableFieldName => nameof(_ActionOnDisable);
#endif
/// <summary>[<see cref="SerializeField"/>]
/// Determines what happens when this component is disabled or its <see cref="GameObject"/> becomes inactive
/// (i.e. in <see cref="OnDisable"/>).
/// </summary>
/// <remarks>The default value is <see cref="DisableAction.Stop"/>.</remarks>
public ref DisableAction ActionOnDisable => ref _ActionOnDisable;
/// <inheritdoc/>
bool IAnimancerComponent.ResetOnDisable => _ActionOnDisable == DisableAction.Reset;
/// <summary>
/// An action to perform when disabling an <see cref="AnimancerComponent"/>. See <see cref="ActionOnDisable"/>.
/// </summary>
public enum DisableAction
{
/// <summary>
/// Stop all animations and rewind them, but leave all animated values as they are (unlike
/// <see cref="Reset"/>).
/// </summary>
/// <remarks>Calls <see cref="Stop()"/> and <see cref="AnimancerPlayable.PauseGraph"/>.</remarks>
Stop,
/// <summary>Pause all animations in their current state so they can resume later.</summary>
/// <remarks>Calls <see cref="AnimancerPlayable.PauseGraph"/>.</remarks>
Pause,
/// <summary>Keep playing while inactive.</summary>
Continue,
/// <summary>
/// Stop all animations, rewind them, and force the object back into its original state (often called the
/// bind pose).
/// </summary>
/// <remarks>
/// The <see cref="AnimancerComponent"/> must be either above the <see cref="UnityEngine.Animator"/> in
/// the Inspector or on a child object so that so that this <see cref="OnDisable"/> gets called first.
/// <para></para>
/// Calls <see cref="Stop()"/>, <see cref="Animator.Rebind"/>, and <see cref="AnimancerPlayable.PauseGraph"/>.
/// </remarks>
Reset,
/// <summary>
/// Destroy the <see cref="PlayableGraph"/> and all its layers and states. This means that any layers or
/// states referenced by other scripts will no longer be valid so they will need to be recreated if you
/// want to use this object again.
/// </summary>
/// <remarks>Calls <see cref="AnimancerPlayable.DestroyGraph()"/>.</remarks>
Destroy,
}
/************************************************************************************************************************/
#region Update Mode
/************************************************************************************************************************/
/// <summary>
/// Determines when animations are updated and which time source is used. This property is mainly a wrapper
/// around the <see cref="Animator.updateMode"/>.
/// </summary>
/// <remarks>Note that changing to or from <see cref="AnimatorUpdateMode.AnimatePhysics"/> at runtime has no effect.</remarks>
/// <exception cref="NullReferenceException">No <see cref="Animator"/> is assigned.</exception>
public AnimatorUpdateMode UpdateMode
{
get => _Animator.updateMode;
set
{
_Animator.updateMode = value;
if (!IsPlayableInitialized)
return;
// UnscaledTime on the Animator is actually identical to Normal when using the Playables API so we need
// to set the graph's DirectorUpdateMode to determine how it gets its delta time.
_Playable.UpdateMode = value == AnimatorUpdateMode.UnscaledTime ?
DirectorUpdateMode.UnscaledGameTime :
DirectorUpdateMode.GameTime;
#if UNITY_EDITOR
if (InitialUpdateMode == null)
{
InitialUpdateMode = value;
}
else if (UnityEditor.EditorApplication.isPlaying)
{
if (AnimancerPlayable.HasChangedToOrFromAnimatePhysics(InitialUpdateMode, value))
Debug.LogWarning($"Changing the {nameof(Animator)}.{nameof(Animator.updateMode)}" +
$" to or from {nameof(AnimatorUpdateMode.Fixed)} at runtime will have no effect." +
" You must set it in the Unity Editor or on startup.", this);
}
#endif
}
}
/************************************************************************************************************************/
#if UNITY_EDITOR
/// <inheritdoc/>
public AnimatorUpdateMode? InitialUpdateMode { get; private set; }
#endif
/************************************************************************************************************************/
#endregion
/************************************************************************************************************************/
#endregion
/************************************************************************************************************************/
#region Initialization
/************************************************************************************************************************/
#if UNITY_EDITOR
/// <summary>[Editor-Only]
/// Destroys the <see cref="Playable"/> if it was initialized and searches for an <see cref="Animator"/> on
/// this object, or it's children or parents.
/// </summary>
/// <remarks>
/// Called by the Unity Editor when this component is first added (in Edit Mode) and whenever the Reset command
/// is executed from its context menu.
/// </remarks>
protected virtual void Reset()
{
OnDestroy();
gameObject.GetComponentInParentOrChildren(ref _Animator);
}
#endif
/************************************************************************************************************************/
/// <summary>Ensures that the <see cref="PlayableGraph"/> is playing.</summary>
/// <remarks>Called by Unity when this component becomes enabled and active.</remarks>
protected virtual void OnEnable()
{
if (IsPlayableInitialized)
_Playable.UnpauseGraph();
}
/// <summary>Acts according to the <see cref="ActionOnDisable"/>.</summary>
/// <remarks>Called by Unity when this component becomes disabled or inactive.</remarks>
protected virtual void OnDisable()
{
if (!IsPlayableInitialized)
return;
switch (_ActionOnDisable)
{
case DisableAction.Stop:
Stop();
_Playable.PauseGraph();
break;
case DisableAction.Pause:
_Playable.PauseGraph();
break;
case DisableAction.Continue:
break;
case DisableAction.Reset:
Debug.Assert(_Animator.isActiveAndEnabled,
$"{nameof(DisableAction)}.{nameof(DisableAction.Reset)} failed because the {nameof(Animator)} is not enabled." +
$" This most likely means you are disabling the {nameof(GameObject)} and the {nameof(Animator)} is above the" +
$" {nameof(AnimancerComponent)} in the Inspector so it got disabled right before this method was called." +
$" See the Inspector of {this} to fix the issue" +
$" or use {nameof(DisableAction)}.{nameof(DisableAction.Stop)}" +
$" and call {nameof(Animator)}.{nameof(Animator.Rebind)} manually" +
$" before disabling the {nameof(GameObject)}.",
this);
Stop();
_Animator.Rebind();
_Playable.PauseGraph();
break;
case DisableAction.Destroy:
_Playable.DestroyGraph();
_Playable = null;
break;
default:
throw new ArgumentOutOfRangeException(nameof(ActionOnDisable));
}
}
/************************************************************************************************************************/
/// <summary>Creates a new <see cref="AnimancerPlayable"/> if it doesn't already exist.</summary>
public void InitializePlayable()
{
if (IsPlayableInitialized)
return;
if (_Animator == null)
_Animator = GetComponent<Animator>();
#if UNITY_ASSERTIONS
ValidatePlayableInitialization();
#endif
AnimancerPlayable.SetNextGraphName(name + " (Animancer)");
_Playable = AnimancerPlayable.Create();
_Playable.CreateOutput(_Animator, this);
#if UNITY_EDITOR
if (_Animator != null)
InitialUpdateMode = UpdateMode;
#endif
}
/************************************************************************************************************************/
/// <summary>Creates a new <see cref="AnimancerPlayable"/> in the specified `graph`.</summary>
/// <exception cref="InvalidOperationException">
/// The <see cref="AnimancerPlayable"/> is already initialized.
/// You must call <see cref="AnimancerPlayable.DestroyGraph"/> before re-initializing it.
/// </exception>
public void InitializePlayable(PlayableGraph graph)
{
if (IsPlayableInitialized)
throw new InvalidOperationException($"The {nameof(AnimancerPlayable)} is already initialized." +
$" Either call this method before anything else uses it or call" +
$" animancerComponent.{nameof(Playable)}.{nameof(AnimancerPlayable.DestroyGraph)} before re-initializing it.");
if (_Animator == null)
_Animator = GetComponent<Animator>();
#if UNITY_ASSERTIONS
ValidatePlayableInitialization();
#endif
_Playable = AnimancerPlayable.Create(graph);
_Playable.CreateOutput(_Animator, this);
#if UNITY_EDITOR
if (_Animator != null)
InitialUpdateMode = UpdateMode;
#endif
}
/************************************************************************************************************************/
#if UNITY_ASSERTIONS
/// <summary>Validates various conditions relating to <see cref="AnimancerPlayable"/> initialization.</summary>
private void ValidatePlayableInitialization()
{
#if UNITY_EDITOR
if (OptionalWarning.CreateGraphDuringGuiEvent.IsEnabled())
{
var currentEvent = Event.current;
if (currentEvent != null && (currentEvent.type == EventType.Layout || currentEvent.type == EventType.Repaint))
OptionalWarning.CreateGraphDuringGuiEvent.Log(
$"An {nameof(AnimancerPlayable)} is being created during a {currentEvent.type} event" +
$" which is likely undesirable.", this);
}
if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode)
#endif
{
if (!gameObject.activeInHierarchy)
OptionalWarning.CreateGraphWhileDisabled.Log($"An {nameof(AnimancerPlayable)} is being created for '{this}'" +
$" which is attached to an inactive {nameof(GameObject)}." +
$" If that object is never activated then Unity will not call {nameof(OnDestroy)}" +
$" so {nameof(AnimancerPlayable)}.{nameof(AnimancerPlayable.DestroyGraph)} will need to be called manually.", this);
}
if (_Animator != null && _Animator.isHuman && _Animator.runtimeAnimatorController != null)
OptionalWarning.NativeControllerHumanoid.Log($"An Animator Controller is assigned to the" +
$" {nameof(Animator)} component but the Rig is Humanoid so it can't be blended with Animancer." +
$" See the documentation for more information: {Strings.DocsURLs.AnimatorControllersNative}", this);
}
#endif
/************************************************************************************************************************/
/// <summary>Ensures that the <see cref="Playable"/> is properly cleaned up.</summary>
/// <remarks>Called by Unity when this component is destroyed.</remarks>
protected virtual void OnDestroy()
{
if (IsPlayableInitialized)
{
_Playable.DestroyGraph();
_Playable = null;
}
}
/************************************************************************************************************************/
#if UNITY_EDITOR
/// <summary>[Editor-Only]
/// Ensures that the <see cref="AnimancerPlayable"/> is destroyed in Edit Mode, but not in Play Mode since we want
/// to let Unity complain if that happens.
/// </summary>
~AnimancerComponent()
{
if (_Playable != null)
{
UnityEditor.EditorApplication.delayCall += () =>
{
if (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode)
OnDestroy();
};
}
}
#endif
/************************************************************************************************************************/
#endregion
/************************************************************************************************************************/
#region Play Management
/************************************************************************************************************************/
/// <summary>
/// Returns the `clip` itself. This method is used to determine the dictionary key to use for an animation
/// when none is specified by the user, such as in <see cref="Play(AnimationClip)"/>. It can be overridden by
/// child classes to use something else as the key.
/// </summary>
public virtual object GetKey(AnimationClip clip) => clip;
/************************************************************************************************************************/
// Play Immediately.
/************************************************************************************************************************/
/// <summary>Stops all other animations on the same layer, plays the `clip`, and returns its state.</summary>
/// <remarks>
/// The animation will continue playing from its current <see cref="AnimancerState.Time"/>.
/// To restart it from the beginning you can use <c>...Play(clip).Time = 0;</c>.
/// <para></para>
/// This method is safe to call repeatedly without checking whether the `clip` was already playing.
/// </remarks>
public AnimancerState Play(AnimationClip clip)
=> Playable.Play(States.GetOrCreate(clip));
/// <summary>Stops all other animations on the same layer, plays the `state`, and returns it.</summary>
/// <remarks>
/// The animation will continue playing from its current <see cref="AnimancerState.Time"/>.
/// To restart it from the beginning you can use <c>...Play(state).Time = 0;</c>.
/// <para></para>
/// This method is safe to call repeatedly without checking whether the `state` was already playing.
/// </remarks>
public AnimancerState Play(AnimancerState state)
=> Playable.Play(state);
/************************************************************************************************************************/
// Cross Fade.
/************************************************************************************************************************/
/// <summary>
/// Starts fading in the `clip` while fading out all other states in the same layer over the course of the
/// `fadeDuration`. Returns its state.
/// </summary>
/// <remarks>
/// If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
/// method will allow it to complete the existing fade rather than starting a slower one.
/// <para></para>
/// If the layer currently has 0 <see cref="AnimancerNode.Weight"/>, this method will fade in the layer itself
/// and simply <see cref="AnimancerState.Play"/> the `state`.
/// <para></para>
/// This method is safe to call repeatedly without checking whether the `clip` was already playing.
/// <para></para>
/// <em>Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in runtime builds.</em>
/// </remarks>
public AnimancerState Play(AnimationClip clip, float fadeDuration, FadeMode mode = default)
=> Playable.Play(States.GetOrCreate(clip), fadeDuration, mode);
/// <summary>
/// Starts fading in the `state` while fading out all others in the same layer over the course of the
/// `fadeDuration`. Returns the `state`.
/// </summary>
/// <remarks>
/// If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
/// method will allow it to complete the existing fade rather than starting a slower one.
/// <para></para>
/// If the layer currently has 0 <see cref="AnimancerNode.Weight"/>, this method will fade in the layer itself
/// and simply <see cref="AnimancerState.Play"/> the `state`.
/// <para></para>
/// This method is safe to call repeatedly without checking whether the `state` was already playing.
/// <para></para>
/// <em>Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in runtime builds.</em>
/// </remarks>
public AnimancerState Play(AnimancerState state, float fadeDuration, FadeMode mode = default)
=> Playable.Play(state, fadeDuration, mode);
/************************************************************************************************************************/
// Transition.
/************************************************************************************************************************/
/// <summary>
/// Creates a state for the `transition` if it didn't already exist, then calls
/// <see cref="Play(AnimancerState)"/> or <see cref="Play(AnimancerState, float, FadeMode)"/>
/// depending on <see cref="ITransition.CrossFadeFromStart"/>.
/// </summary>
/// <remarks>
/// This method is safe to call repeatedly without checking whether the `transition` was already playing.
/// </remarks>
public AnimancerState Play(ITransition transition)
=> Playable.Play(transition);
/// <summary>
/// Creates a state for the `transition` if it didn't already exist, then calls
/// <see cref="Play(AnimancerState)"/> or <see cref="Play(AnimancerState, float, FadeMode)"/>
/// depending on <see cref="ITransition.CrossFadeFromStart"/>.
/// </summary>
/// <remarks>
/// This method is safe to call repeatedly without checking whether the `transition` was already playing.
/// </remarks>
public AnimancerState Play(ITransition transition, float fadeDuration, FadeMode mode = default)
=> Playable.Play(transition, fadeDuration, mode);
/************************************************************************************************************************/
// Try Play.
/************************************************************************************************************************/
/// <summary>
/// Stops all other animations on the same layer, plays the animation registered with the `key`, and returns
/// that state. Or if no state is registered with that `key`, this method does nothing and returns null.
/// </summary>
/// <remarks>
/// The animation will continue playing from its current <see cref="AnimancerState.Time"/>.
/// If you wish to force it back to the start, you can simply set the returned state's time to 0.
/// <para></para>
/// This method is safe to call repeatedly without checking whether the animation was already playing.
/// </remarks>
/// <exception cref="ArgumentNullException">The `key` is null.</exception>
public AnimancerState TryPlay(object key)
=> Playable.TryPlay(key);
/// <summary>
/// Starts fading in the animation registered with the `key` while fading out all others in the same layer
/// over the course of the `fadeDuration`. Or if no state is registered with that `key`, this method does
/// nothing and returns null.
/// </summary>
/// <remarks>
/// If the `state` was already playing and fading in with less time remaining than the `fadeDuration`, this
/// method will allow it to complete the existing fade rather than starting a slower one.
/// <para></para>
/// If the layer currently has 0 <see cref="AnimancerNode.Weight"/>, this method will fade in the layer itself
/// and simply <see cref="AnimancerState.Play"/> the `state`.
/// <para></para>
/// This method is safe to call repeatedly without checking whether the animation was already playing.
/// <para></para>
/// <em>Animancer Lite only allows the default `fadeDuration` (0.25 seconds) in runtime builds.</em>
/// </remarks>
/// <exception cref="ArgumentNullException">The `key` is null.</exception>
public AnimancerState TryPlay(object key, float fadeDuration, FadeMode mode = default)
=> Playable.TryPlay(key, fadeDuration, mode);
/************************************************************************************************************************/
/// <summary>
/// Gets the state associated with the `clip`, stops and rewinds it to the start, then returns it.
/// </summary>
public AnimancerState Stop(AnimationClip clip) => Stop(GetKey(clip));
/// <summary>
/// Gets the state registered with the <see cref="IHasKey.Key"/>, stops and rewinds it to the start, then
/// returns it.
/// </summary>
public AnimancerState Stop(IHasKey hasKey) => _Playable?.Stop(hasKey);
/// <summary>
/// Gets the state associated with the `key`, stops and rewinds it to the start, then returns it.
/// </summary>
public AnimancerState Stop(object key) => _Playable?.Stop(key);
/// <summary>
/// Stops all animations and rewinds them to the start.
/// </summary>
public void Stop()
{
if (_Playable != null)
_Playable.Stop();
}
/************************************************************************************************************************/
/// <summary>
/// Returns true if a state is registered for the `clip` and it is currently playing.
/// <para></para>
/// The actual dictionary key is determined using <see cref="GetKey"/>.
/// </summary>
public bool IsPlaying(AnimationClip clip) => IsPlaying(GetKey(clip));
/// <summary>
/// Returns true if a state is registered with the <see cref="IHasKey.Key"/> and it is currently playing.
/// </summary>
public bool IsPlaying(IHasKey hasKey) => _Playable != null && _Playable.IsPlaying(hasKey);
/// <summary>
/// Returns true if a state is registered with the `key` and it is currently playing.
/// </summary>
public bool IsPlaying(object key) => _Playable != null && _Playable.IsPlaying(key);
/// <summary>
/// Returns true if at least one animation is being played.
/// </summary>
public bool IsPlaying() => _Playable != null && _Playable.IsPlaying();
/************************************************************************************************************************/
/// <summary>
/// Returns true if the `clip` is currently being played by at least one state.
/// <para></para>
/// This method is inefficient because it searches through every state to find any that are playing the `clip`,
/// unlike <see cref="IsPlaying(AnimationClip)"/> which only checks the state registered using the `clip`s key.
/// </summary>
public bool IsPlayingClip(AnimationClip clip) => _Playable != null && _Playable.IsPlayingClip(clip);
/************************************************************************************************************************/
/// <summary>
/// Evaluates all of the currently playing animations to apply their states to the animated objects.
/// </summary>
public void Evaluate() => Playable.Evaluate();
/// <summary>
/// Advances all currently playing animations by the specified amount of time (in seconds) and evaluates the
/// graph to apply their states to the animated objects.
/// </summary>
public void Evaluate(float deltaTime) => Playable.Evaluate(deltaTime);
/************************************************************************************************************************/
#region Key Error Methods
#if UNITY_EDITOR
/************************************************************************************************************************/
// These are overloads of other methods that take a System.Object key to ensure the user doesn't try to use an
// AnimancerState as a key, since the whole point of a key is to identify a state in the first place.
/************************************************************************************************************************/
/// <summary>[Warning]
/// You should not use an <see cref="AnimancerState"/> as a key.
/// Just call <see cref="AnimancerState.Stop"/>.
/// </summary>
[Obsolete("You should not use an AnimancerState as a key. Just call AnimancerState.Stop().", true)]
public AnimancerState Stop(AnimancerState key)
{
key.Stop();
return key;
}
/// <summary>[Warning]
/// You should not use an <see cref="AnimancerState"/> as a key.
/// Just check <see cref="AnimancerState.IsPlaying"/>.
/// </summary>
[Obsolete("You should not use an AnimancerState as a key. Just check AnimancerState.IsPlaying.", true)]
public bool IsPlaying(AnimancerState key) => key.IsPlaying;
/************************************************************************************************************************/
#endif
#endregion
/************************************************************************************************************************/
#endregion
/************************************************************************************************************************/
#region Enumeration
/************************************************************************************************************************/
// IEnumerator for yielding in a coroutine to wait until all animations have stopped.
/************************************************************************************************************************/
/// <summary>
/// Determines if any animations are still playing so this object can be used as a custom yield instruction.
/// </summary>
bool IEnumerator.MoveNext()
{
if (!IsPlayableInitialized)
return false;
return ((IEnumerator)_Playable).MoveNext();
}
/// <summary>Returns null.</summary>
object IEnumerator.Current => null;
/// <summary>Does nothing.</summary>
void IEnumerator.Reset() { }
/************************************************************************************************************************/
/// <summary>[<see cref="IAnimationClipSource"/>]
/// Calls <see cref="GatherAnimationClips(ICollection{AnimationClip})"/>.
/// </summary>
public void GetAnimationClips(List<AnimationClip> clips)
{
var set = ObjectPool.AcquireSet<AnimationClip>();
set.UnionWith(clips);
GatherAnimationClips(set);
clips.Clear();
clips.AddRange(set);
ObjectPool.Release(set);
}
/************************************************************************************************************************/
/// <summary>[<see cref="IAnimationClipCollection"/>]
/// Gathers all the animations in the <see cref="Playable"/>.
/// <para></para>
/// In the Unity Editor this method also gathers animations from other components on parent and child objects.
/// </summary>
public virtual void GatherAnimationClips(ICollection<AnimationClip> clips)
{
if (IsPlayableInitialized)
_Playable.GatherAnimationClips(clips);
#if UNITY_EDITOR
Editor.AnimationGatherer.GatherFromGameObject(gameObject, clips);
if (_Animator != null && _Animator.gameObject != gameObject)
Editor.AnimationGatherer.GatherFromGameObject(_Animator.gameObject, clips);
#endif
}
/************************************************************************************************************************/
#endregion
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 0ad50f81b1d25c441943c37a89ba23f6
labels:
- Component
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+10
View File
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 833bcac93994ed2459b0b7f61940e220
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e62ef3f454894fe438fd8cabc7306a76
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 163e49daa533d5a47ad9f25c93148e63
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/basics/quick-play/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 24769847b5734a24f9106589bf6bf3bc
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.Basics
{
/// <summary>
/// Starts with an idle animation and performs an action when the user clicks the mouse, then returns to idle.
/// </summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/basics/quick-play">Quick Play</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.Basics/PlayAnimationOnClick
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Basics - Play Animation On Click")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(Basics) + "/" + nameof(PlayAnimationOnClick))]
public sealed class PlayAnimationOnClick : MonoBehaviour
{
/************************************************************************************************************************/
// Without Animancer, you would reference an Animator component to control animations.
// But with Animancer, you reference an AnimancerComponent instead.
[SerializeField] private AnimancerComponent _Animancer;
// Without Animancer, you would create an Animator Controller to define animation states and transitions.
// But with Animancer, you can directly reference the AnimationClips you want to play.
[SerializeField] private AnimationClip _Idle;
[SerializeField] private AnimationClip _Action;
/************************************************************************************************************************/
/// <summary>On startup, play the idle animation.</summary>
private void OnEnable()
{
// On startup, play the idle animation.
_Animancer.Play(_Idle);
}
/************************************************************************************************************************/
private void Update()
{
// Every update, check if the user has clicked the left mouse button (mouse button 0).
if (Input.GetMouseButtonDown(0))
{
// If they have, then play the action animation.
var state = _Animancer.Play(_Action);
// The Play method returns the AnimancerState which manages that animation so you can access and
// control various details, for example:
// state.Time = 1;// Skip 1 second into the animation.
// state.NormalizedTime = 0.5f;// Skip halfway into the animation.
// state.Speed = 2;// Play the animation twice as fast.
// In this case, we just want it to call the OnActionEnd method (see below) when the animation ends.
state.Events.OnEnd = OnActionEnd;
}
}
/************************************************************************************************************************/
private void OnActionEnd()
{
// Now that the action is done, go back to idle. But instead of snapping to the new animation instantly,
// tell it to fade gradually over 0.25 seconds so that it transitions smoothly.
_Animancer.Play(_Idle, 0.25f);
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 0ee05891e0dfea44b9489ef029d84ba5
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,925 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &320333586 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100006, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1692701679}
m_PrefabAsset: {fileID: 0}
--- !u!114 &320333587
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320333586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ee05891e0dfea44b9489ef029d84ba5, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animancer: {fileID: 320333588}
_Idle: {fileID: 7400000, guid: 3dfaee2bd1f29534a89b5c3f307678f8, type: 2}
_Action: {fileID: 7400000, guid: 6b6754727a425b241bd179af348a5153, type: 2}
--- !u!114 &320333588
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320333586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ad50f81b1d25c441943c37a89ba23f6, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animator: {fileID: 320333589}
_ActionOnDisable: 0
--- !u!95 &320333589 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 9500000, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1692701679}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &486475402
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 986564005}
m_Modifications:
- target: {fileID: 1334077016099822, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_Name
value: GolfClub
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
--- !u!1 &557811823
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 557811827}
- component: {fileID: 557811826}
- component: {fileID: 557811825}
- component: {fileID: 557811824}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &557811824
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 557811823}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &557811825
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 557811823}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &557811826
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 557811823}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &557811827
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 557811823}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1733240000}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!4 &986564005 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400110, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1692701679}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1275168795
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1275168797}
- component: {fileID: 1275168796}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1275168796
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1275168795}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 0.8
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1275168797
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1275168795}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2029758843}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1585703003
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1585703007}
- component: {fileID: 1585703006}
- component: {fileID: 1585703005}
- component: {fileID: 1585703004}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!64 &1585703004
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1585703003}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1585703005
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1585703003}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: bc28db22991ead048a61c46b6d7d7bc5, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1585703006
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1585703003}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1585703007
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1585703003}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1617243221
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 100006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_Name
value: DefaultHumanoid Putt
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.y
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9500000, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
--- !u!1 &1617243222 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100006, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1617243221}
m_PrefabAsset: {fileID: 0}
--- !u!95 &1617243223 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 9500000, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1617243221}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1617243224 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400110, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1617243221}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1617243225
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1617243222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ad50f81b1d25c441943c37a89ba23f6, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animator: {fileID: 1617243223}
_ActionOnDisable: 0
--- !u!114 &1617243226
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1617243222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ee05891e0dfea44b9489ef029d84ba5, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animancer: {fileID: 1617243225}
_Idle: {fileID: 7400000, guid: 81598115abce14a4b8458817996013c9, type: 2}
_Action: {fileID: 7400000, guid: 5dbb868fc5f0491498f9d89a49f2df20, type: 2}
--- !u!1001 &1692701679
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 100006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_Name
value: DefaultHumanoid Swing
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.x
value: -1.5
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.y
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9500000, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
--- !u!1 &1733239999
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1733240000}
- component: {fileID: 1733240002}
- component: {fileID: 1733240001}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1733240000
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733239999}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 557811827}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -5, y: 5}
m_SizeDelta: {x: 160, y: 50}
m_Pivot: {x: 1, y: 0}
--- !u!114 &1733240001
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733239999}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 8
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Left Click = Swing
--- !u!222 &1733240002
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733239999}
m_CullTransparentMesh: 0
--- !u!1001 &1970070837
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1617243224}
m_Modifications:
- target: {fileID: 1009789547296276, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_Name
value: GolfPutter
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalPosition.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
--- !u!1 &2029758839
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2029758843}
- component: {fileID: 2029758842}
- component: {fileID: 2029758841}
- component: {fileID: 2029758840}
- component: {fileID: 2029758844}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &2029758840
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_Enabled: 1
--- !u!124 &2029758841
Behaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_Enabled: 1
--- !u!20 &2029758842
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.5019608, g: 0.627451, b: 0.8784314, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &2029758843
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -3}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1275168797}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2029758844
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d1ae14bf1f98371428ee080a75de9aa0, type: 3}
m_Name:
m_EditorClassIdentifier:
_FocalPoint: {x: 0, y: 1, z: 0}
_MouseButton: 1
_Sensitivity: {x: 15, y: -10, z: -0.1}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 282a8d809865a0c4eb365527784ce028
labels:
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f59c56d7a1823ea43b4ad425047eac30
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/basics/playing-and-fading/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 46f99d3a3e4b22841a9fbafa15892247
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 62c232f7bb9346d48ab8fb2ba70f6449
labels:
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,133 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.Basics
{
/// <summary>Demonstrates the differences between various ways of playing and fading between animations.</summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/basics/playing-and-fading">Playing and Fading</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.Basics/PlayingAndFading
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Basics - Playing and Fading")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(Basics) + "/" + nameof(PlayingAndFading))]
public sealed class PlayingAndFading : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private AnimationClip _Idle;
[SerializeField] private AnimationClip _Action;
/************************************************************************************************************************/
private void OnEnable()
{
_Animancer.Play(_Idle);
}
/************************************************************************************************************************/
// Called by a UI Button.
public void Play()
{
// Immediately snap from the previous pose to the start of the action.
_Animancer.Play(_Action);
// If the action was already playing, it will continue from its current time.
// When the animation ends it will freeze in its final pose.
}
// Called by a UI Button.
public void PlayThenIdle()
{
// Play then return to the Idle animation when the action is finished.
_Animancer.Play(_Action).Events.OnEnd = () => _Animancer.Play(_Idle);
// Here we are using a "Lambda Expression" to declare the callback method inside the current method.
// In this case we could have assigned OnEnable to the event since it does the same thing:
// _Animancer.Play(_Action).Events.OnEnd = OnEnable;
// But that is not always so convenient and "OnEnable" is not really an appropriate name for what it does.
// We could have used multiple lines like so:
// var state = _Animancer.Play(_Action);
// state.Events.OnEnd = () => _Animancer.Play(_Idle);
// But since we only want to do one thing with the state, we can just do it on one line.
// Note that the events are all automatically cleared whenever a new animation is played.
// This ensures that the above Play method will not have to worry about any of these other methods that
// might have set their own events.
}
// Called by a UI Button.
public void PlayFromStart()
{
// Play and make sure it is at the start instead of allowing it to continue from its current time.
_Animancer.Play(_Action).Time = 0;
}
// Called by a UI Button.
public void PlayFromStartThenIdle()
{
// Combine both of the above.
var state = _Animancer.Play(_Action);
state.Time = 0;
state.Events.OnEnd = () => _Animancer.Play(_Idle);
}
/************************************************************************************************************************/
// Called by a UI Button.
public void CrossFade()
{
// Smoothly transition to the action over 0.25 seconds.
_Animancer.Play(_Action, 0.25f);
}
// Called by a UI Button.
public void CrossFadeThenIdle()
{
// Same as PlayThenIdle, but since the line is getting a bit long we can split it.
// Note how the first line does not have a semicolon at the end.
_Animancer.Play(_Action, 0.25f)
.Events.OnEnd = () => _Animancer.Play(_Idle, 0.25f);
}
// Called by a UI Button.
public void BadCrossFadeFromStart()
{
// Unlike PlayFromStart, setting the Time is not good when cross fading because it prevents a smooth
// transition from the previous pose into the new animation.
_Animancer.Play(_Action, 0.25f).Time = 0;
}
// Called by a UI Button.
public void GoodCrossFadeFromStart()
{
// Instead, we can use FadeMode.FromStart to ensure that it is smooth.
// See the documentation of FadeMode.FromStart for details.
_Animancer.Play(_Action, 0.25f, FadeMode.FromStart);
}
// Called by a UI Button.
public void GoodCrossFadeFromStartThenIdle()
{
// For completeness, combine both of the above.
_Animancer.Play(_Action, 0.25f, FadeMode.FromStart)
.Events.OnEnd = () => _Animancer.Play(_Idle, 0.25f);
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: dfff62a1b6849774f990c02242787aff
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4b90e38b961ebbf4393e2fdcf3d1619b
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/basics/transitions/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6e282ac53b96b1b40a61f816faae380c
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,62 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.Basics
{
/// <summary>
/// This script is basically the same as <see cref="PlayAnimationOnClick"/>, except that it uses
/// <see href="https://kybernetik.com.au/animancer/docs/manual/transitions">Transitions</see>.
/// </summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/basics/transitions">Transitions</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.Basics/PlayTransitionOnClick
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Basics - Play Transition On Click")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(Basics) + "/" + nameof(PlayTransitionOnClick))]
public sealed class PlayTransitionOnClick : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private ClipTransition _Idle;
[SerializeField] private ClipTransition _Action;
/************************************************************************************************************************/
private void OnEnable()
{
// Transitions store their events so we only initialize them once on startup
// instead of setting the event every time the animation is played.
_Action.Events.OnEnd = OnActionEnd;
// The Fade Duration of this transition will be ignored because nothing else is playing yet so there is
// nothing to fade from.
_Animancer.Play(_Idle);
}
/************************************************************************************************************************/
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
_Animancer.Play(_Action);
// The end event was already assigned in OnEnable.
}
}
/************************************************************************************************************************/
private void OnActionEnd()
{
// No need to hard-code the Fade Duration.
// The transitions allow us to edit it in the Inspector.
_Animancer.Play(_Idle);
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: cceb40f118608e64695f74fb2bdc6894
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,957 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &320333586 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100006, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1692701679}
m_PrefabAsset: {fileID: 0}
--- !u!114 &320333587
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320333586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cceb40f118608e64695f74fb2bdc6894, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animancer: {fileID: 320333588}
_Idle:
_FadeDuration: 0.25
_Events:
_Names: []
_NormalizedTimes: []
_Callbacks: []
_Clip: {fileID: 7400000, guid: 3dfaee2bd1f29534a89b5c3f307678f8, type: 2}
_Speed: 1
_NormalizedStartTime: NaN
_Action:
_FadeDuration: 0.25
_Events:
_Names: []
_NormalizedTimes: []
_Callbacks: []
_Clip: {fileID: 7400000, guid: 6b6754727a425b241bd179af348a5153, type: 2}
_Speed: 1
_NormalizedStartTime: NaN
--- !u!114 &320333588
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320333586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ad50f81b1d25c441943c37a89ba23f6, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animator: {fileID: 320333589}
_ActionOnDisable: 0
--- !u!95 &320333589 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 9500000, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1692701679}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &486475402
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 986564005}
m_Modifications:
- target: {fileID: 1334077016099822, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_Name
value: GolfClub
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4159243965375922, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d5a1ce9c9c7fc98448206f07959206cf, type: 3}
--- !u!1 &557811823
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 557811827}
- component: {fileID: 557811826}
- component: {fileID: 557811825}
- component: {fileID: 557811824}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &557811824
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 557811823}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &557811825
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 557811823}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &557811826
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 557811823}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &557811827
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 557811823}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1733240000}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!4 &986564005 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400110, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1692701679}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1275168795
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1275168797}
- component: {fileID: 1275168796}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1275168796
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1275168795}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 0.8
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1275168797
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1275168795}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2029758843}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1585703003
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1585703007}
- component: {fileID: 1585703006}
- component: {fileID: 1585703005}
- component: {fileID: 1585703004}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!64 &1585703004
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1585703003}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1585703005
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1585703003}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: bc28db22991ead048a61c46b6d7d7bc5, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1585703006
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1585703003}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1585703007
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1585703003}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1617243221
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 100006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_Name
value: DefaultHumanoid Putt
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.y
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9500000, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
--- !u!1 &1617243222 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100006, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1617243221}
m_PrefabAsset: {fileID: 0}
--- !u!95 &1617243223 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 9500000, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1617243221}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1617243224 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400110, guid: c9f3e1113795a054c939de9883b31fed,
type: 3}
m_PrefabInstance: {fileID: 1617243221}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1617243225
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1617243222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ad50f81b1d25c441943c37a89ba23f6, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animator: {fileID: 1617243223}
_ActionOnDisable: 0
--- !u!114 &1617243226
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1617243222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cceb40f118608e64695f74fb2bdc6894, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animancer: {fileID: 1617243225}
_Idle:
_FadeDuration: 0.25
_Events:
_Names: []
_NormalizedTimes: []
_Callbacks: []
_Clip: {fileID: 7400000, guid: 81598115abce14a4b8458817996013c9, type: 2}
_Speed: 1
_NormalizedStartTime: NaN
_Action:
_FadeDuration: 0.25
_Events:
_Names: []
_NormalizedTimes: []
_Callbacks: []
_Clip: {fileID: 7400000, guid: 5dbb868fc5f0491498f9d89a49f2df20, type: 2}
_Speed: 1
_NormalizedStartTime: NaN
--- !u!1001 &1692701679
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 100006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_Name
value: DefaultHumanoid Swing
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.x
value: -1.5
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.y
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400006, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9500000, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c9f3e1113795a054c939de9883b31fed, type: 3}
--- !u!1 &1733239999
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1733240000}
- component: {fileID: 1733240002}
- component: {fileID: 1733240001}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1733240000
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733239999}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 557811827}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -5, y: 5}
m_SizeDelta: {x: 160, y: 50}
m_Pivot: {x: 1, y: 0}
--- !u!114 &1733240001
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733239999}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 8
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Left Click = Swing
--- !u!222 &1733240002
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1733239999}
m_CullTransparentMesh: 0
--- !u!1001 &1970070837
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1617243224}
m_Modifications:
- target: {fileID: 1009789547296276, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_Name
value: GolfPutter
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalPosition.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4520760566764840, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4dac93b538ecdaa4a84b22b1f0cc929c, type: 3}
--- !u!1 &2029758839
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2029758843}
- component: {fileID: 2029758842}
- component: {fileID: 2029758841}
- component: {fileID: 2029758840}
- component: {fileID: 2029758844}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &2029758840
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_Enabled: 1
--- !u!124 &2029758841
Behaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_Enabled: 1
--- !u!20 &2029758842
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.5019608, g: 0.627451, b: 0.8784314, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &2029758843
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -3}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1275168797}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2029758844
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2029758839}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d1ae14bf1f98371428ee080a75de9aa0, type: 3}
m_Name:
m_EditorClassIdentifier:
_FocalPoint: {x: 0, y: 1, z: 0}
_MouseButton: 1
_Sensitivity: {x: 15, y: -10, z: -0.1}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 346a5c6f1e4f21a429049448cdb79ed1
labels:
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4e87b1bfbe8da3d4db600f368cbc2b58
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/basics/named-animations/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6e13d61567c5bb84c9ef1ec6a939a5de
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ceb762bf09208914fa2d21dc31321ec9
labels:
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,120 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using System;
using UnityEngine;
namespace Animancer.Examples.Basics
{
/// <summary>
/// Demonstrates how to use a <see cref="NamedAnimancerComponent"/> to play animations by name.
/// </summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/basics/named-animations">Named Animations</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.Basics/NamedAnimations
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Basics - Named Animations")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(Basics) + "/" + nameof(NamedAnimations))]
public sealed class NamedAnimations : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField] private NamedAnimancerComponent _Animancer;
[SerializeField] private AnimationClip _Walk;
[SerializeField] private AnimationClip _Run;
/************************************************************************************************************************/
// Idle.
/************************************************************************************************************************/
// Called by a UI Button.
/// <summary>
/// Plays the idle animation by name. This requires the animation to already have a state in the
/// <see cref="NamedAnimancerComponent"/>, which has already been done in this example by adding it to the
/// <see cref="NamedAnimancerComponent.Animations"/> list in the Inspector.
/// <para></para>
/// If it has not been added, this method will simply do nothing.
/// </summary>
public void PlayIdle()
{
_Animancer.TryPlay("Humanoid-Idle");
}
/************************************************************************************************************************/
// Walk.
/************************************************************************************************************************/
// Called by a UI Button.
/// <summary>
/// Plays the walk animation by name. Unlike the idle animation, this one has not been added to the
/// Inspector list so it will not exist and this method will log a warning unless you call
/// <see cref="InitializeWalkState"/> first.
/// </summary>
public void PlayWalk()
{
var state = _Animancer.TryPlay("Humanoid-Walk");
if (state == null)
Debug.LogWarning("No state has been registered with 'Humanoid-Walk' as its key yet.");
// _Animancer.TryPlay(_Walk.name); would also work,
// but if we are going to use the clip we should really just use _Animancer.Play(_Walk);
}
/************************************************************************************************************************/
// Called by a UI Button.
/// <summary>
/// Creates a state for the walk animation so that <see cref="PlayWalk"/> can play it.
/// </summary>
/// <remarks>
/// Calling this method more than once will throw an <see cref="ArgumentException"/> because a state already
/// exists with the key it's trying to use (the animation's name).
/// <para></para>
/// If we wanted to allow repeated calls we could use
/// <see cref="AnimancerLayer.GetOrCreateState(AnimationClip, bool)"/> instead, which would create a state the
/// first time then return the same one every time after that.
/// <para></para>
/// If we wanted to actually create multiple states for the same animation, we would have to use the optional
/// `key` parameter to specify a different key for each of them.
/// </remarks>
public void InitializeWalkState()
{
_Animancer.States.Create(_Walk);
Debug.Log("Created a state to play " + _Walk, this);
}
/************************************************************************************************************************/
// Run.
/************************************************************************************************************************/
// Called by a UI Button.
/// <summary>
/// Plays the run animation using a direct reference to show that the ability to play animations by
/// name in a <see cref="NamedAnimancerComponent"/> does not prevent it from also using direct references like
/// the base <see cref="AnimancerComponent"/>.
/// </summary>
public void PlayRun()
{
_Animancer.Play(_Run);
// What actually happens internally looks more like this:
// object key = _Animancer.GetKey(_Run);
// var state = _Animancer.GetOrCreate(key, _Run);
// _Animancer.Play(state);
// The base AnimancerComponent.GetKey returns the AnimationClip to use as its own key, but
// NamedAnimancerComponent overrides it to instead return the clip's name. This is a bit less
// efficient, but it allows us to use clips (like we are here) or names (like with the idle)
// interchangeably.
// After the 'Run' state has been created, we could do any of the following:
// _Animancer.GetState(_Run) or GetState("Run").
// _Animancer.Play(_Run) or Play("Run").
// Same for CrossFade, and CrossFadeFromStart.
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 4af81067e188cc04b96335ab81ca4cec
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/basics/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3cdb093f033611943803f6d98253fc37
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dbbca4e31839a6847a34520ae8912075
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4d527b22548c8394b8600d26d11820d7
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/fine-control/spider-bot/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e677e973e3467d74da1114f8c267af1b
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,834 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.4400227, g: 0.488517, b: 0.56871074, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &46466209
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 46466213}
- component: {fileID: 46466212}
- component: {fileID: 46466211}
- component: {fileID: 46466210}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &46466210
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 46466209}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &46466211
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 46466209}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &46466212
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 46466209}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &46466213
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 46466209}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 164196550}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &164196549
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 164196550}
- component: {fileID: 164196552}
- component: {fileID: 164196551}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &164196550
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 164196549}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 46466213}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -10, y: -10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &164196551
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 164196549}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 40
m_Alignment: 6
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Space = Wake up and walk
--- !u!222 &164196552
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 164196549}
m_CullTransparentMesh: 0
--- !u!1 &420215836
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 420215840}
- component: {fileID: 420215839}
- component: {fileID: 420215838}
- component: {fileID: 420215837}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!64 &420215837
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 420215836}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &420215838
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 420215836}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: bc28db22991ead048a61c46b6d7d7bc5, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &420215839
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 420215836}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &420215840
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 420215836}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &459241889
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 459241892}
- component: {fileID: 459241891}
- component: {fileID: 459241890}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &459241890
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 459241889}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &459241891
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 459241889}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &459241892
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 459241889}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1091332531
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1091332535}
- component: {fileID: 1091332534}
- component: {fileID: 1091332533}
- component: {fileID: 1091332532}
- component: {fileID: 1091332536}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1091332532
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1091332531}
m_Enabled: 1
--- !u!124 &1091332533
Behaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1091332531}
m_Enabled: 1
--- !u!20 &1091332534
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1091332531}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.5019608, g: 0.627451, b: 0.8784314, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1091332535
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1091332531}
m_LocalRotation: {x: 0.22975297, y: 0, z: 0, w: 0.973249}
m_LocalPosition: {x: 0, y: 1.5000001, z: -2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1572662127}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 55, y: 0, z: 0}
--- !u!114 &1091332536
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1091332531}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d1ae14bf1f98371428ee080a75de9aa0, type: 3}
m_Name:
m_EditorClassIdentifier:
_FocalPoint: {x: 0, y: 0.5, z: 0}
_MouseButton: 1
_Sensitivity: {x: 15, y: -10, z: -0.1}
--- !u!1 &1572662125
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1572662127}
- component: {fileID: 1572662126}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1572662126
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1572662125}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1572662127
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1572662125}
m_LocalRotation: {x: -0.4082179, y: 0.2345698, z: -0.10938169, w: -0.8754261}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1091332535}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1001 &2083691253
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2146305107}
m_Modifications:
- target: {fileID: 100028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_Name
value: SpiderBot
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9500000, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9d49a00a420822146b5d90f22e280024, type: 3}
--- !u!95 &2083691254 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 9500000, guid: 9d49a00a420822146b5d90f22e280024,
type: 3}
m_PrefabInstance: {fileID: 2083691253}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2083691255 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100028, guid: 9d49a00a420822146b5d90f22e280024,
type: 3}
m_PrefabInstance: {fileID: 2083691253}
m_PrefabAsset: {fileID: 0}
--- !u!4 &2083691256 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400028, guid: 9d49a00a420822146b5d90f22e280024,
type: 3}
m_PrefabInstance: {fileID: 2083691253}
m_PrefabAsset: {fileID: 0}
--- !u!114 &2083691257
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2083691255}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ad50f81b1d25c441943c37a89ba23f6, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animator: {fileID: 2083691254}
_ActionOnDisable: 0
--- !u!1 &2146305105
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2146305107}
- component: {fileID: 2146305106}
m_Layer: 0
m_Name: Spider Bot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2146305106
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2146305105}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 832010bad74bb88448c66480d6211e35, type: 3}
m_Name:
m_EditorClassIdentifier:
_Animancer: {fileID: 2083691257}
_WakeUp:
_FadeDuration: 0.25
_Events:
_NormalizedTimes: []
_Callbacks: []
_Names: []
_Clip: {fileID: 7400000, guid: 51ed4b7a94fecdb48a1e2993a1538dc7, type: 2}
_Speed: 1
_NormalizedStartTime: NaN
_Sleep:
_FadeDuration: 0.25
_Events:
_NormalizedTimes: []
_Callbacks: []
_Names: []
_Clip: {fileID: 7400000, guid: 51ed4b7a94fecdb48a1e2993a1538dc7, type: 2}
_Speed: -1
_NormalizedStartTime: NaN
_Move:
_FadeDuration: 0.25
_Events:
_NormalizedTimes: []
_Callbacks: []
_Names: []
_Clip: {fileID: 7400000, guid: 289a266921b90344fa42bebb00880d63, type: 2}
_Speed: 1
_NormalizedStartTime: NaN
--- !u!4 &2146305107
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2146305105}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2083691256}
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: eca86df0e7dde3348bb8603b0091850b
labels:
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,95 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.FineControl
{
/// <summary>
/// Demonstrates how to play a single "Wake Up" animation forwards to wake up and backwards to go back to sleep.
/// </summary>
///
/// <remarks>
/// This is an abstract class which is inherited by <see cref="SpiderBotSimple"/> and
/// <see cref="Locomotion.SpiderBotAdvanced"/>, meaning that you cannot attach this script to an object (because it
/// would be useless on its own) and both of those scripts get to share its functionality without needing to copy
/// the same methods into each of them.
/// </remarks>
///
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/fine-control/spider-bot">Spider Bot</see></example>
///
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.FineControl/SpiderBot
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Fine Control - Spider Bot")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(FineControl) + "/" + nameof(SpiderBot))]
public abstract class SpiderBot : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField]
private AnimancerComponent _Animancer;
public AnimancerComponent Animancer => _Animancer;
[SerializeField] private ClipTransition _WakeUp;
[SerializeField] private ClipTransition _Sleep;
private bool _WasMoving;
/************************************************************************************************************************/
protected abstract bool IsMoving { get; }
protected abstract ITransition MovementAnimation { get; }
/************************************************************************************************************************/
protected virtual void Awake()
{
// Start paused at the beginning of the animation.
_Animancer.Play(_WakeUp);
_Animancer.Evaluate();
_Animancer.Playable.PauseGraph();
// Initialize the OnEnd events here so we don't allocate garbage every time they are used.
_WakeUp.Events.OnEnd = () => _Animancer.Play(MovementAnimation);
_Sleep.Events.OnEnd = _Animancer.Playable.PauseGraph;
}
/************************************************************************************************************************/
protected virtual void Update()
{
if (IsMoving)
{
if (!_WasMoving)
{
_WasMoving = true;
// Make sure the graph is unpaused (because we pause it when going back to sleep).
_Animancer.Playable.UnpauseGraph();
_Animancer.Play(_WakeUp);
}
}
else
{
if (_WasMoving)
{
_WasMoving = false;
var state = _Animancer.Play(_Sleep);
// If it was past the last frame, skip back to the last frame now that it is playing backwards.
// Otherwise just play backwards from the current time.
if (state.NormalizedTime > 1)
state.NormalizedTime = 1;
// If we did not initialize the OnEnd event in Awake, we could set it here:
// state.OnEnd = _Animancer.Playable.PauseGraph;
}
}
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: a151a5d75ce3bfb40bc68d538fac8c3f
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.FineControl
{
/// <summary>A <see cref="SpiderBot"/> with a single movement animation for demonstration purposes.</summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/fine-control/spider-bot">Spider Bot</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.FineControl/SpiderBotSimple
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Fine Control - Spider Bot Simple")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(FineControl) + "/" + nameof(SpiderBotSimple))]
public sealed class SpiderBotSimple : SpiderBot
{
/************************************************************************************************************************/
protected override bool IsMoving => Input.GetKey(KeyCode.Space);
/************************************************************************************************************************/
[SerializeField] private ClipTransition _Move;
protected override ITransition MovementAnimation => _Move;
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 832010bad74bb88448c66480d6211e35
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 31ad720bedcdd774eae3049d6a0c0fe1
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,50 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
using UnityEngine;
namespace Animancer.Examples.FineControl
{
/// <summary>An object that can be interacted with.</summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/fine-control/doors">Doors</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.FineControl/IInteractable
///
public interface IInteractable
{
/************************************************************************************************************************/
void Interact();
/************************************************************************************************************************/
}
/// <summary>
/// Attempts to interact with whatever <see cref="IInteractable"/> the cursor is pointing at when the user clicks
/// the mouse.
/// </summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/fine-control/doors">Doors</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.FineControl/ClickToInteract
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Fine Control - Click To Interact")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(FineControl) + "/" + nameof(ClickToInteract))]
public sealed class ClickToInteract : MonoBehaviour
{
/************************************************************************************************************************/
private void Update()
{
if (!Input.GetMouseButtonDown(0))
return;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out var raycastHit))
{
var interactable = raycastHit.collider.GetComponentInParent<IInteractable>();
if (interactable != null)
interactable.Interact();
}
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: c96e2773a3c77da489a21ae218fbcdf0
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/fine-control/doors/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4c6078c1caa079944ba92867860221c4
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,98 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.FineControl
{
/// <summary>
/// An <see cref="IInteractable"/> door which toggles between open and closed when something interacts with it.
/// </summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/fine-control/doors">Doors</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.FineControl/Door
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Fine Control - Door")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(FineControl) + "/" + nameof(Door))]
[SelectionBase]
public sealed class Door : MonoBehaviour, IInteractable
{
/************************************************************************************************************************/
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private AnimationClip _Open;
[SerializeField, Range(0, 1)]
private float _Openness;
/************************************************************************************************************************/
private void Awake()
{
// Apply the starting state and pause the graph.
var state = _Animancer.Play(_Open);
state.NormalizedTime = _Openness;
_Animancer.Evaluate();
_Animancer.Playable.PauseGraph();
// And also pause it whenever the animation finishes to save performance.
state.Events.OnEnd = _Animancer.Playable.PauseGraph;
// Normally the OnEnd event would be cleared whenever we play a new animation, but since there is only one
// animation in this example we just leave it playing and pause/unpause the graph instead.
}
/************************************************************************************************************************/
/// <summary>[<see cref="IInteractable"/>] Toggles this door between open and closed.</summary>
public void Interact()
{
// Get the state to set its speed (or we could have just kept the state from Awake).
var state = _Animancer.States[_Open];
// If currently near closed, play the animation forwards.
if (_Openness < 0.5f)
{
state.Speed = 1;
_Openness = 1;
}
else// Otherwise play it backwards.
{
state.Speed = -1;
_Openness = 0;
}
// And make sure the graph is playing.
_Animancer.Playable.UnpauseGraph();
}
/************************************************************************************************************************/
#if UNITY_EDITOR
/************************************************************************************************************************/
/// <summary>[Editor-Only] Applies the starting openness value to the door in Edit Mode.</summary>
/// <remarks>Called in Edit Mode whenever this script is loaded or a value is changed in the Inspector.</remarks>
private void OnValidate()
{
if (_Animancer == null ||
_Open == null ||
UnityEditor.EditorUtility.IsPersistent(this))
return;
// Delay for a frame. Otherwise Unity gives an error after recompiling scripts.
UnityEditor.EditorApplication.delayCall += () =>
{
if (_Animancer == null ||
_Open == null ||
UnityEditor.EditorUtility.IsPersistent(this))
return;
Awake();
};
}
/************************************************************************************************************************/
#endif
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 9e32da90076ea94418b3a83e0c784500
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3397f9eae5c6c3a4984564cbb7f7eb8c
labels:
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,199 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: OpenDoor
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0, y: 0, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 1
value: {x: 0, y: 90.00001, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
path:
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 5
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 4
script: {fileID: 0}
typeID: 4
customType: 4
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.x
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 90.00001
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.y
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.z
path:
classID: 4
script: {fileID: 0}
m_EulerEditorCurves:
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.x
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.y
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.z
path:
classID: 4
script: {fileID: 0}
m_HasGenericRootTransform: 1
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 921d3a2f01d448d478d6be64e00ca5d9
labels:
- Example
- Generic
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: fd4126b55d52ebb448e316e1588f0792
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/fine-control/solo-animation/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 72dcd76a82ebe7a498cfb5d6a6df455b
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,315 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: OpenPortcullis
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0, y: 0, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 15
value: {x: -1080, y: 0, z: 0}
inSlope: {x: -98.5067, y: 0, z: 0}
outSlope: {x: -98.5067, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.065487735, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
path: Wheel/Axle
m_PositionCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0, y: 0, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 15
value: {x: 0, y: 2.5, z: 0}
inSlope: {x: 0, y: 0.44322583, z: 0}
outSlope: {x: 0, y: 0.44322583, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.10065759, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
path: Gate
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 5
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 404305834
attribute: 1
script: {fileID: 0}
typeID: 4
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 2936134494
attribute: 4
script: {fileID: 0}
typeID: 4
customType: 4
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 15
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 15
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.x
path: Gate
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 15
value: 2.5
inSlope: 0.44322583
outSlope: 0.44322583
tangentMode: 0
weightedMode: 0
inWeight: 0.10065759
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.y
path: Gate
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 15
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.z
path: Gate
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 15
value: -1080
inSlope: -98.5067
outSlope: -98.5067
tangentMode: 0
weightedMode: 0
inWeight: 0.065487735
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.x
path: Wheel/Axle
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 15
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.y
path: Wheel/Axle
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 15
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.z
path: Wheel/Axle
classID: 4
script: {fileID: 0}
m_EulerEditorCurves:
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.x
path: Wheel/Axle
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.y
path: Wheel/Axle
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.z
path: Wheel/Axle
classID: 4
script: {fileID: 0}
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 26358a5d9c6ca314bbf84c67940ef5bb
labels:
- Example
- Generic
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d62fb389152caf540aa68375d1ec0a2d
labels:
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 87d3c58c482b7b346b14d094d7dfe0a4
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/fine-control/update-rate/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: af25d92ad50847f48b20f191cf1c4317
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using Animancer.Units;
using UnityEngine;
namespace Animancer.Examples.FineControl
{
/// <summary>
/// Demonstrates how to save some performance by updating Animancer at a lower frequency when the character is far
/// away from the camera.
/// </summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/fine-control/update-rate">Update Rate</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.FineControl/DynamicUpdateRate
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Fine Control - Dynamic Update Rate")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(FineControl) + "/" + nameof(DynamicUpdateRate))]
public sealed class DynamicUpdateRate : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField] private LowUpdateRate _LowUpdateRate;
[SerializeField] private TextMesh _TextMesh;
[SerializeField, Meters] private float _SlowUpdateDistance = 5;
private Transform _Camera;
/************************************************************************************************************************/
private void Awake()
{
// Finding the Camera.main is a slow operation so we don't want to repeat it every update.
_Camera = Camera.main.transform;
}
/************************************************************************************************************************/
private void Update()
{
// Compare the squared distance to the camera with the squared threshold.
// This is more efficient than calculating the distance because it avoids the square root calculation.
var offset = _Camera.position - transform.position;
var squaredDistance = offset.sqrMagnitude;
// enabled = true if the distance is larger.
// enabled = false if the distance is smaller
_LowUpdateRate.enabled = squaredDistance > _SlowUpdateDistance * _SlowUpdateDistance;
// For the sake of this example, use a TextMesh to show the current details.
var distance = Mathf.Sqrt(squaredDistance);
var updating = _LowUpdateRate.enabled ? "Slowly" : "Normally";
_TextMesh.text = $"Distance {distance}\nUpdating {updating}\n\nDynamic Rate";
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: c8bd145b52d29fe4b906fb29e95f54bd
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,62 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.FineControl
{
/// <summary>Demonstrates how to save some performance by updating Animancer less often.</summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/fine-control/update-rate">Update Rate</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.FineControl/LowUpdateRate
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Fine Control - Low Update Rate")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(FineControl) + "/" + nameof(LowUpdateRate))]
public sealed class LowUpdateRate : MonoBehaviour
{
/************************************************************************************************************************/
// This script doesn't play any animations.
// In a real game, you would have other scripts doing that.
// But for this example, we are just using a NamedAnimancerComponent for its Play Automatically field.
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private float _UpdatesPerSecond = 10;
private float _LastUpdateTime;
/************************************************************************************************************************/
// The DynamicUpdateRate script will enable and disable this script.
/************************************************************************************************************************/
private void OnEnable()
{
_Animancer.Playable.PauseGraph();
_LastUpdateTime = Time.time;
}
private void OnDisable()
{
// This will get called when destroying the object as well (such as when loading a different scene).
// So we need to make sure the AnimancerComponent still exists and is still initialized.
if (_Animancer != null && _Animancer.IsPlayableInitialized)
_Animancer.Playable.UnpauseGraph();
}
/************************************************************************************************************************/
private void Update()
{
var time = Time.time;
var timeSinceLastUpdate = time - _LastUpdateTime;
if (timeSinceLastUpdate > 1 / _UpdatesPerSecond)
{
_Animancer.Evaluate(timeSinceLastUpdate);
_LastUpdateTime = time;
}
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: d01dc3616ae98ae44b3b3810f38503fd
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: aeb756b1d2412da4190e7112fdc69d11
labels:
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/fine-control/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: ff995a1ba2abf384fa42c46b5837d072
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 87af2382c5da4d34dbd51f7aeaa93d8a
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 849954663bd4eeb45a86ed79b8489134
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/locomotion/root-motion/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 56b38d2a5809f154da16fb2477b973b4
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: cb642f0b925465b41b0a772842af75db
labels:
- Example
- RootMotion
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,125 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using Animancer.Units;
using System;
using UnityEngine;
namespace Animancer.Examples.Locomotion
{
/// <summary>Demonstrates how to use Root Motion for some animations but not others.</summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/locomotion/root-motion">Root Motion</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.Locomotion/RootMotion
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Locomotion - Root Motion")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(Locomotion) + "/" + nameof(RootMotion))]
public sealed class RootMotion : MonoBehaviour
{
/************************************************************************************************************************/
/// <summary>
/// A <see cref="ClipTransition"/> with an <see cref="_ApplyRootMotion"/> toggle.
/// </summary>
[Serializable]
public class MotionTransition : ClipTransition
{
/************************************************************************************************************************/
[SerializeField, Tooltip("Determines if Root Motion should be enabled when this animation plays")]
private bool _ApplyRootMotion;
/************************************************************************************************************************/
public override void Apply(AnimancerState state)
{
base.Apply(state);
state.Root.Component.Animator.applyRootMotion = _ApplyRootMotion;
}
/************************************************************************************************************************/
}
/************************************************************************************************************************/
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField, Meters] private float _MaxDistance;
[SerializeField] private MotionTransition[] _Animations;
private Vector3 _Start;
/************************************************************************************************************************/
private void OnEnable()
{
_Start = transform.position;
Play(0);
}
/************************************************************************************************************************/
/// <summary>Plays the animation at the specified `index` in the <see cref="_Animations"/> array.</summary>
/// <remarks>This method is called by UI Buttons.</remarks>
public void Play(int index)
{
_Animancer.Play(_Animations[index]);
}
/************************************************************************************************************************/
/// <summary>
/// Teleports this object back to its starting location if it moves too far.
/// </summary>
private void FixedUpdate()
{
if (Vector3.Distance(_Start, transform.position) > _MaxDistance)
transform.position = _Start;
}
/************************************************************************************************************************/
// These fields determine which object the Root Motion will be applied to.
// You would normally only have one of these for whichever system you are using to move your characters.
// But for this example, we have all of them to demonstrate how each could be used.
[SerializeField] private Transform _MotionTransform;
[SerializeField] private Rigidbody _MotionRigidbody;
[SerializeField] private CharacterController _MotionCharacterController;
/// <summary>
/// Called when the <see cref="Animator"/> would apply Root Motion. Applies that Root Motion to a different
/// object instead.
/// <para></para>
/// This can be useful if for example the character's <see cref="Rigidbody"/> or
/// <see cref="CharacterController"/> is on a parent of the <see cref="Animator"/> so that the model is kept
/// separate from the character's mechanics.
/// </summary>
private void OnAnimatorMove()
{
if (!_Animancer.Animator.applyRootMotion)
return;
if (_MotionTransform != null)
{
_MotionTransform.position += _Animancer.Animator.deltaPosition;
_MotionTransform.rotation *= _Animancer.Animator.deltaRotation;
}
else if (_MotionRigidbody != null)
{
_MotionRigidbody.MovePosition(_MotionRigidbody.position + _Animancer.Animator.deltaPosition);
_MotionRigidbody.MoveRotation(_MotionRigidbody.rotation * _Animancer.Animator.deltaRotation);
}
else if (_MotionCharacterController != null)
{
_MotionCharacterController.Move(_Animancer.Animator.deltaPosition);
_MotionCharacterController.transform.rotation *= _Animancer.Animator.deltaRotation;
}
else
{
// If we aren't retargeting, just let Unity apply the Root Motion normally.
_Animancer.Animator.ApplyBuiltinRootMotion();
}
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 4c8071e1fe562ae4ab39a0a1e0feb196
labels:
- Example
- RootMotion
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9530026a5fc3b7f4d978ce1d85e00ade
labels:
- Example
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
[InternetShortcut]
URL=https://kybernetik.com.au/animancer/docs/examples/locomotion/linear-blending/
IDList=
HotKey=0
IconIndex=0
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6efdacef9d0eb8941af2ad089655c994
labels:
- Documentation
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9e115319934f3d74da38fccdc46a78a9
labels:
- BlendTree
- Example
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,145 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 15ed7dccdb910ec4896f03f7cc2ede35, type: 3}
m_Name: Linear Locomotion Controller Transition
m_EditorClassIdentifier:
_Transition:
id: 0
references:
version: 1
00000000:
type: {class: Float1ControllerTransition, ns: Animancer, asm: Animancer}
data:
_FadeDuration: 0.25
_Events:
_Names: []
_NormalizedTimes: []
_Callbacks: []
_Controller: {fileID: 91242112294343564}
_NormalizedStartTime: NaN
_KeepStateOnStop: 0
_ParameterName: Speed
--- !u!91 &91242112294343564
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Linear Locomotion Blend Tree
serializedVersion: 5
m_AnimatorParameters:
- m_Name: Speed
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 91242112294343564}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 1107240474225256196}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 91242112294343564}
--- !u!206 &206771759363972004
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Move
m_Childs:
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: c2ecee9424461bf4e864486b30ec0e9e, type: 2}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: fd6e0d48a65905843a5f784b7acb18f0, type: 2}
m_Threshold: 0.5
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
- serializedVersion: 2
m_Motion: {fileID: 7400000, guid: c63f72fd084b58f48aee5221a4429f51, type: 2}
m_Threshold: 1
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_CycleOffset: 0
m_DirectBlendParameter: Blend
m_Mirror: 0
m_BlendParameter: Speed
m_BlendParameterY: Blend
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 0
m_NormalizedBlendValues: 0
m_BlendType: 0
--- !u!1102 &1102252175982360230
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Move
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 206771759363972004}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &1107240474225256196
AnimatorStateMachine:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 1102252175982360230}
m_Position: {x: 288, y: 120, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 1102252175982360230}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6af14faa583e327499f7bae10bcc3ab0
labels:
- Example
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,39 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a472a4806da7f9147a4a5cd7eee170df, type: 3}
m_Name: Linear Locomotion Mixer Transition
m_EditorClassIdentifier:
_Transition:
id: 0
references:
version: 1
00000000:
type: {class: LinearMixerTransition, ns: Animancer, asm: Animancer}
data:
_FadeDuration: 0.25
_Events:
_NormalizedTimes: []
_Callbacks: []
_Names: []
_Speed: 1
_Animations:
- {fileID: 7400000, guid: c2ecee9424461bf4e864486b30ec0e9e, type: 2}
- {fileID: 7400000, guid: fd6e0d48a65905843a5f784b7acb18f0, type: 2}
- {fileID: 7400000, guid: c63f72fd084b58f48aee5221a4429f51, type: 2}
_Speeds: []
_SynchronizeChildren: 00
_Thresholds:
- 0
- 0.5
- 1
_DefaultParameter: 0
_ExtrapolateSpeed: 1
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a7f0583d7b4d49244829b41e1830d1e5
labels:
- Example
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.Locomotion
{
/// <summary>
/// An example of how you can wrap a <see cref="RuntimeAnimatorController"/> containing a single blend tree in a
/// <see cref="Float1ControllerState"/> to easily control its parameter.
/// </summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/locomotion/linear-blending">Linear Blending</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.Locomotion/LinearBlendTreeLocomotion
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Locomotion - Linear Blend Tree Locomotion")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(Locomotion) + "/" + nameof(LinearBlendTreeLocomotion))]
public sealed class LinearBlendTreeLocomotion : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private Float1ControllerTransitionAsset.UnShared _Controller;
/************************************************************************************************************************/
private void OnEnable()
{
_Animancer.Play(_Controller);
}
/************************************************************************************************************************/
/// <summary>Controlled by a <see cref="UnityEngine.UI.Slider"/>.</summary>
public float Speed
{
get => _Controller.State.Parameter;
set => _Controller.State.Parameter = value;
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 05247140c60c03240b12d3d3e1ef39a5
labels:
- BlendTree
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.Locomotion
{
/// <summary>
/// An example of how you can use a <see cref="LinearMixerState"/> to mix a set of animations based on a
/// <see cref="Speed"/> parameter.
/// </summary>
/// <example><see href="https://kybernetik.com.au/animancer/docs/examples/locomotion/linear-blending">Linear Blending</see></example>
/// https://kybernetik.com.au/animancer/api/Animancer.Examples.Locomotion/LinearMixerLocomotion
///
[AddComponentMenu(Strings.ExamplesMenuPrefix + "Locomotion - Linear Mixer Locomotion")]
[HelpURL(Strings.DocsURLs.ExampleAPIDocumentation + nameof(Locomotion) + "/" + nameof(LinearMixerLocomotion))]
public sealed class LinearMixerLocomotion : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private LinearMixerTransitionAsset.UnShared _Mixer;
/************************************************************************************************************************/
private void OnEnable()
{
_Animancer.Play(_Mixer);
}
/************************************************************************************************************************/
/// <summary>Controlled by a <see cref="UnityEngine.UI.Slider"/>.</summary>
public float Speed
{
get => _Mixer.State.Parameter;
set => _Mixer.State.Parameter = value;
}
/************************************************************************************************************************/
}
}
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: b37a00002bed35a458f61190db3e694f
labels:
- Example
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More