-
Notifications
You must be signed in to change notification settings - Fork 6
/
AnimatorState.cs
58 lines (48 loc) · 1.7 KB
/
AnimatorState.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using SaintsField.Animate;
using UnityEngine;
namespace SaintsField
{
[Serializable]
public struct AnimatorState: IAnimationClip, ILayerIndex, IStateNameHash, IStateName, IStateSpeed, IStateTag, ISubStateMachineNameChain
{
[field: SerializeField]
public int layerIndex { get; private set; }
[field: SerializeField]
public int stateNameHash { get; private set; }
[field: SerializeField]
public string stateName { get; private set; }
[field: SerializeField]
public float stateSpeed { get; private set; }
[field: SerializeField]
public string stateTag { get; private set; }
[field: SerializeField]
public AnimationClip animationClip { get; private set; }
[field: SerializeField]
public string[] subStateMachineNameChain { get; private set; }
public override string ToString() => $"[{layerIndex}] {stateName}{(animationClip? $" ({animationClip.name})": "")}";
public override bool Equals(object obj)
{
// Check for null and compare run-time types.
if (obj == null || GetType() != obj.GetType())
{
return false;
}
return Equals((AnimatorState) obj);
}
public bool Equals(AnimatorState other)
{
return layerIndex == other.layerIndex
&& stateNameHash == other.stateNameHash;
}
public override int GetHashCode()
{
unchecked
{
int hashCode = layerIndex;
hashCode = (hashCode * 397) ^ stateNameHash;
return hashCode;
}
}
}
}