Class AnimationAttribute
Animation attribute to control animations for a state machine.
Namespace: nickmaltbie.StateMachineUnity.Attributes
Assembly: cs.temp.dll.dll
Syntax
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public class AnimationAttribute : Attribute
Constructors
AnimationAttribute(String, Single, Boolean, Single)
Associate an animation with a given state.
Declaration
public AnimationAttribute(string stateName, float defaultTransitionTime = 0F, bool fixedTimeTransition = false, float animationLockTime = 0F)
Parameters
Type | Name | Description |
---|---|---|
String | stateName | String name of the state. |
Single | defaultTransitionTime | Default transition time when transitioning to this animation. |
Boolean | fixedTimeTransition | Is this transition in fixed time (true) or normalized time (false). |
Single | animationLockTime | Time to lock animation during transition. |
Properties
AnimationHash
Animation hash associated with the state this is attached to.
Declaration
public virtual int AnimationHash { get; protected set; }
Property Value
Type | Description |
---|---|
Int32 |
AnimationLockTime
Time to lock animation during transition.
Declaration
public float AnimationLockTime { get; protected set; }
Property Value
Type | Description |
---|---|
Single |
DefaultTransitionTime
Default transition time when transitioning to this animation.
Declaration
public float DefaultTransitionTime { get; protected set; }
Property Value
Type | Description |
---|---|
Single |
FixedTimeTransition
Is this transition in fixed time or normalized time.
Declaration
public bool FixedTimeTransition { get; protected set; }
Property Value
Type | Description |
---|---|
Boolean |
StateName
state name for the current animation being played.
Declaration
public string StateName { get; protected set; }
Property Value
Type | Description |
---|---|
String |
Methods
GetStateAnimation(Type, Object)
Gets the animation associated with a given state.
Declaration
public static int? GetStateAnimation(Type state, object instance)
Parameters
Type | Name | Description |
---|---|---|
Type | state | State to search attribute for. |
Object | instance |
Returns
Type | Description |
---|---|
Nullable<Int32> |