You've already forked FateViewer
Add project files.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
public static class CustomPlayableExtensions
|
||||
{
|
||||
public static void ResetTime(this Playable playable, float time)
|
||||
{
|
||||
playable.SetTime(time);
|
||||
playable.SetTime(time);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d6aadfd4af940c47a915f6e609245bd
|
||||
timeCreated: 1519667576
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/Scripts/SimpleAnimationComponent/Editor.meta
Normal file
10
Assets/Scripts/SimpleAnimationComponent/Editor.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13eb8d583b55e3f4998b9c8d1fc4f631
|
||||
folderAsset: yes
|
||||
timeCreated: 1502472444
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "SimpleAnimationComponent-Editor",
|
||||
"references": [
|
||||
"SimpleAnimationComponent"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4073e604354115342b874ea3137b12f7
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,92 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(SimpleAnimation))]
|
||||
public class SimpleAnimationEditor : Editor
|
||||
{
|
||||
static class Styles
|
||||
{
|
||||
public static GUIContent animation = new GUIContent("Animation", "The clip that will be played if Play() is called, or if \"Play Automatically\" is enabled");
|
||||
public static GUIContent animations = new GUIContent("Animations", "These clips will define the States the component will start with");
|
||||
public static GUIContent playAutomatically = new GUIContent("Play Automatically", "If checked, the default clip will automatically be played");
|
||||
public static GUIContent animatePhysics = new GUIContent("Animate Physics", "If checked, animations will be updated at the same frequency as Fixed Update");
|
||||
|
||||
public static GUIContent cullingMode = new GUIContent("Culling Mode", "Controls what is updated when the object has been culled");
|
||||
}
|
||||
|
||||
SerializedProperty clip;
|
||||
SerializedProperty states;
|
||||
SerializedProperty playAutomatically;
|
||||
SerializedProperty animatePhysics;
|
||||
SerializedProperty cullingMode;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
clip = serializedObject.FindProperty("m_Clip");
|
||||
states = serializedObject.FindProperty("m_States");
|
||||
playAutomatically = serializedObject.FindProperty("m_PlayAutomatically");
|
||||
animatePhysics = serializedObject.FindProperty("m_AnimatePhysics");
|
||||
cullingMode = serializedObject.FindProperty("m_CullingMode");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
EditorGUILayout.PropertyField(clip, Styles.animation);
|
||||
EditorGUILayout.PropertyField(states, Styles.animations, true);
|
||||
EditorGUILayout.PropertyField(playAutomatically, Styles.playAutomatically);
|
||||
EditorGUILayout.PropertyField(animatePhysics, Styles.animatePhysics);
|
||||
EditorGUILayout.PropertyField(cullingMode, Styles.cullingMode);
|
||||
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(SimpleAnimation.EditorState))]
|
||||
class StateDrawer : PropertyDrawer
|
||||
{
|
||||
class Styles
|
||||
{
|
||||
public static readonly GUIContent disabledTooltip = new GUIContent("", "The Default state cannot be edited, change the Animation clip to change the Default State");
|
||||
}
|
||||
|
||||
// Draw the property inside the given rect
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
// Using BeginProperty / EndProperty on the parent property means that
|
||||
// prefab override logic works on the entire property.
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
// Draw label
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
|
||||
// Don't make child fields be indented
|
||||
var indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
// Calculate rects
|
||||
Rect clipRect = new Rect(position.x, position.y, position.width/2 - 5, position.height);
|
||||
Rect nameRect = new Rect(position.x + position.width/2 + 5, position.y, position.width/2 - 5, position.height);
|
||||
|
||||
|
||||
EditorGUI.BeginDisabledGroup(property.FindPropertyRelative("defaultState").boolValue);
|
||||
EditorGUI.PropertyField(nameRect, property.FindPropertyRelative("clip"), GUIContent.none);
|
||||
EditorGUI.PropertyField(clipRect, property.FindPropertyRelative("name"), GUIContent.none);
|
||||
if (property.FindPropertyRelative("defaultState").boolValue)
|
||||
{
|
||||
EditorGUI.LabelField(position, Styles.disabledTooltip);
|
||||
}
|
||||
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
// Set indent back to what it was
|
||||
EditorGUI.indentLevel = indent;
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b42bbe25e28af494dadccf960ecfc32e
|
||||
timeCreated: 1502472599
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
211
Assets/Scripts/SimpleAnimationComponent/SimpleAnimation.cs
Normal file
211
Assets/Scripts/SimpleAnimationComponent/SimpleAnimation.cs
Normal file
@@ -0,0 +1,211 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
[RequireComponent(typeof(Animator))]
|
||||
public partial class SimpleAnimation: MonoBehaviour
|
||||
{
|
||||
public interface State
|
||||
{
|
||||
bool enabled { get; set; }
|
||||
bool isValid { get; }
|
||||
float time { get; set; }
|
||||
float normalizedTime { get; set; }
|
||||
float speed { get; set; }
|
||||
string name { get; set; }
|
||||
float weight { get; set; }
|
||||
float length { get; }
|
||||
AnimationClip clip { get; }
|
||||
WrapMode wrapMode { get; set; }
|
||||
|
||||
}
|
||||
public Animator animator
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Animator == null)
|
||||
{
|
||||
m_Animator = GetComponent<Animator>();
|
||||
}
|
||||
return m_Animator;
|
||||
}
|
||||
}
|
||||
|
||||
public bool animatePhysics
|
||||
{
|
||||
get { return m_AnimatePhysics; }
|
||||
set { m_AnimatePhysics = value; animator.updateMode = m_AnimatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal; }
|
||||
}
|
||||
|
||||
public AnimatorCullingMode cullingMode
|
||||
{
|
||||
get { return animator.cullingMode; }
|
||||
set { m_CullingMode = value; animator.cullingMode = m_CullingMode; }
|
||||
}
|
||||
|
||||
public bool isPlaying { get { return m_Playable.IsPlaying(); } }
|
||||
|
||||
public bool playAutomatically
|
||||
{
|
||||
get { return m_PlayAutomatically; }
|
||||
set { m_PlayAutomatically = value; }
|
||||
}
|
||||
|
||||
public AnimationClip clip
|
||||
{
|
||||
get { return m_Clip; }
|
||||
set
|
||||
{
|
||||
LegacyClipCheck(value);
|
||||
m_Clip = value;
|
||||
}
|
||||
}
|
||||
|
||||
public WrapMode wrapMode
|
||||
{
|
||||
get { return m_WrapMode; }
|
||||
set { m_WrapMode = value; }
|
||||
}
|
||||
|
||||
public void AddClip(AnimationClip clip, string newName)
|
||||
{
|
||||
LegacyClipCheck(clip);
|
||||
AddState(clip, newName);
|
||||
}
|
||||
|
||||
public void Blend(string stateName, float targetWeight, float fadeLength)
|
||||
{
|
||||
m_Animator.enabled = true;
|
||||
Kick();
|
||||
m_Playable.Blend(stateName, targetWeight, fadeLength);
|
||||
}
|
||||
|
||||
public void CrossFade(string stateName, float fadeLength)
|
||||
{
|
||||
m_Animator.enabled = true;
|
||||
Kick();
|
||||
m_Playable.Crossfade(stateName, fadeLength);
|
||||
}
|
||||
|
||||
public void CrossFadeQueued(string stateName, float fadeLength, QueueMode queueMode)
|
||||
{
|
||||
m_Animator.enabled = true;
|
||||
Kick();
|
||||
m_Playable.CrossfadeQueued(stateName, fadeLength, queueMode);
|
||||
}
|
||||
|
||||
public int GetClipCount()
|
||||
{
|
||||
return m_Playable.GetClipCount();
|
||||
}
|
||||
|
||||
public bool IsPlaying(string stateName)
|
||||
{
|
||||
return m_Playable.IsPlaying(stateName);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
m_Playable.StopAll();
|
||||
}
|
||||
|
||||
public void Stop(string stateName)
|
||||
{
|
||||
m_Playable.Stop(stateName);
|
||||
}
|
||||
|
||||
public void Sample()
|
||||
{
|
||||
m_Graph.Evaluate();
|
||||
}
|
||||
|
||||
public bool Play()
|
||||
{
|
||||
m_Animator.enabled = true;
|
||||
Kick();
|
||||
if (m_Clip != null && m_PlayAutomatically)
|
||||
{
|
||||
m_Playable.Play(kDefaultStateName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void AddState(AnimationClip clip, string name)
|
||||
{
|
||||
LegacyClipCheck(clip);
|
||||
Kick();
|
||||
if (m_Playable.AddClip(clip, name))
|
||||
{
|
||||
RebuildStates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void RemoveState(string name)
|
||||
{
|
||||
if (m_Playable.RemoveClip(name))
|
||||
{
|
||||
RebuildStates();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Play(string stateName)
|
||||
{
|
||||
m_Animator.enabled = true;
|
||||
Kick();
|
||||
return m_Playable.Play(stateName);
|
||||
}
|
||||
|
||||
public void PlayQueued(string stateName, QueueMode queueMode)
|
||||
{
|
||||
m_Animator.enabled = true;
|
||||
Kick();
|
||||
m_Playable.PlayQueued(stateName, queueMode);
|
||||
}
|
||||
|
||||
public void RemoveClip(AnimationClip clip)
|
||||
{
|
||||
if (clip == null)
|
||||
throw new System.NullReferenceException("clip");
|
||||
|
||||
if ( m_Playable.RemoveClip(clip) )
|
||||
{
|
||||
RebuildStates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Rewind()
|
||||
{
|
||||
Kick();
|
||||
m_Playable.Rewind();
|
||||
}
|
||||
|
||||
public void Rewind(string stateName)
|
||||
{
|
||||
Kick();
|
||||
m_Playable.Rewind(stateName);
|
||||
}
|
||||
|
||||
public State GetState(string stateName)
|
||||
{
|
||||
SimpleAnimationPlayable.IState state = m_Playable.GetState(stateName);
|
||||
if (state == null)
|
||||
return null;
|
||||
|
||||
return new StateImpl(state, this);
|
||||
}
|
||||
|
||||
public IEnumerable<State> GetStates()
|
||||
{
|
||||
return new StateEnumerable(this);
|
||||
}
|
||||
|
||||
public State this[string name]
|
||||
{
|
||||
get { return GetState(name); }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3759e2aae0f7b9a47bb98fc64bf3c543
|
||||
timeCreated: 1493315774
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "SimpleAnimationComponent"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aff632302a0b84b498c3f33f7639b4d3
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,754 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.Animations;
|
||||
using System;
|
||||
|
||||
public partial class SimpleAnimationPlayable : PlayableBehaviour
|
||||
{
|
||||
LinkedList<QueuedState> m_StateQueue;
|
||||
StateManagement m_States;
|
||||
bool m_Initialized;
|
||||
|
||||
bool m_KeepStoppedPlayablesConnected = true;
|
||||
public bool keepStoppedPlayablesConnected
|
||||
{
|
||||
get { return m_KeepStoppedPlayablesConnected; }
|
||||
set
|
||||
{
|
||||
if (value != m_KeepStoppedPlayablesConnected)
|
||||
{
|
||||
m_KeepStoppedPlayablesConnected = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateStoppedPlayablesConnections()
|
||||
{
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
if (state == null)
|
||||
continue;
|
||||
if (state.enabled)
|
||||
continue;
|
||||
if (keepStoppedPlayablesConnected)
|
||||
{
|
||||
ConnectInput(state.index);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisconnectInput(state.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Playable m_ActualPlayable;
|
||||
protected Playable self { get { return m_ActualPlayable; } }
|
||||
public Playable playable { get { return self; } }
|
||||
protected PlayableGraph graph { get { return self.GetGraph(); } }
|
||||
|
||||
AnimationMixerPlayable m_Mixer;
|
||||
|
||||
public System.Action onDone = null;
|
||||
public SimpleAnimationPlayable()
|
||||
{
|
||||
m_States = new StateManagement();
|
||||
this.m_StateQueue = new LinkedList<QueuedState>();
|
||||
}
|
||||
|
||||
public Playable GetInput(int index)
|
||||
{
|
||||
if (index >= m_Mixer.GetInputCount())
|
||||
return Playable.Null;
|
||||
|
||||
return m_Mixer.GetInput(index);
|
||||
}
|
||||
|
||||
public override void OnPlayableCreate(Playable playable)
|
||||
{
|
||||
m_ActualPlayable = playable;
|
||||
|
||||
var mixer = AnimationMixerPlayable.Create(graph, 1, true);
|
||||
m_Mixer = mixer;
|
||||
|
||||
self.SetInputCount(1);
|
||||
self.SetInputWeight(0, 1);
|
||||
graph.Connect(m_Mixer, 0, self, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<IState> GetStates()
|
||||
{
|
||||
return new StateEnumerable(this);
|
||||
}
|
||||
|
||||
public IState GetState(string name)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new StateHandle(this, state.index, state.playable);
|
||||
}
|
||||
|
||||
private StateInfo DoAddClip(string name, AnimationClip clip)
|
||||
{
|
||||
//Start new State
|
||||
StateInfo newState = m_States.InsertState();
|
||||
newState.Initialize(name, clip, clip.wrapMode);
|
||||
//Find at which input the state will be connected
|
||||
int index = newState.index;
|
||||
|
||||
//Increase input count if needed
|
||||
if (index == m_Mixer.GetInputCount())
|
||||
{
|
||||
m_Mixer.SetInputCount(index + 1);
|
||||
}
|
||||
|
||||
var clipPlayable = AnimationClipPlayable.Create(graph, clip);
|
||||
clipPlayable.SetApplyFootIK(false);
|
||||
clipPlayable.SetApplyPlayableIK(false);
|
||||
if (!clip.isLooping || newState.wrapMode == WrapMode.Once)
|
||||
{
|
||||
clipPlayable.SetDuration(clip.length);
|
||||
}
|
||||
newState.SetPlayable(clipPlayable);
|
||||
newState.Pause();
|
||||
|
||||
if (keepStoppedPlayablesConnected)
|
||||
ConnectInput(newState.index);
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
public bool AddClip(AnimationClip clip, string name)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state != null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot add state with name {0}, because a state with that name already exists", name));
|
||||
return false;
|
||||
}
|
||||
|
||||
DoAddClip(name, clip);
|
||||
UpdateDoneStatus();
|
||||
InvalidateStates();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool RemoveClip(string name)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot remove state with name {0}, because a state with that name doesn't exist", name));
|
||||
return false;
|
||||
}
|
||||
|
||||
RemoveClones(state);
|
||||
InvalidateStates();
|
||||
m_States.RemoveState(state.index);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool RemoveClip(AnimationClip clip)
|
||||
{
|
||||
InvalidateStates();
|
||||
return m_States.RemoveClip(clip);
|
||||
}
|
||||
|
||||
public bool Play(string name)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot play state with name {0} because there is no state with that name", name));
|
||||
return false;
|
||||
}
|
||||
|
||||
return Play(state.index);
|
||||
}
|
||||
|
||||
private bool Play(int index)
|
||||
{
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
if (state.index == index)
|
||||
{
|
||||
state.Enable();
|
||||
state.ForceWeight(1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoStop(i);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool PlayQueued(string name, QueueMode queueMode)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot queue Play to state with name {0} because there is no state with that name", name));
|
||||
return false;
|
||||
}
|
||||
|
||||
return PlayQueued(state.index, queueMode);
|
||||
}
|
||||
|
||||
bool PlayQueued(int index, QueueMode queueMode)
|
||||
{
|
||||
StateInfo newState = CloneState(index);
|
||||
|
||||
if (queueMode == QueueMode.PlayNow)
|
||||
{
|
||||
Play(newState.index);
|
||||
return true;
|
||||
}
|
||||
|
||||
m_StateQueue.AddLast(new QueuedState(StateInfoToHandle(newState), 0f));
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Rewind(string name)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot Rewind state with name {0} because there is no state with that name", name));
|
||||
return;
|
||||
}
|
||||
|
||||
Rewind(state.index);
|
||||
}
|
||||
|
||||
private void Rewind(int index)
|
||||
{
|
||||
m_States.SetStateTime(index, 0f);
|
||||
}
|
||||
|
||||
public void Rewind()
|
||||
{
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
if (m_States[i] != null)
|
||||
m_States.SetStateTime(i, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveClones(StateInfo state)
|
||||
{
|
||||
var it = m_StateQueue.First;
|
||||
while (it != null)
|
||||
{
|
||||
var next = it.Next;
|
||||
|
||||
StateInfo queuedState = m_States[it.Value.state.index];
|
||||
if (queuedState.parentState.index == state.index)
|
||||
{
|
||||
m_StateQueue.Remove(it);
|
||||
DoStop(queuedState.index);
|
||||
}
|
||||
|
||||
it = next;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Stop(string name)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot stop state with name {0} because there is no state with that name", name));
|
||||
return false;
|
||||
}
|
||||
|
||||
DoStop(state.index);
|
||||
|
||||
UpdateDoneStatus();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void DoStop(int index)
|
||||
{
|
||||
StateInfo state = m_States[index];
|
||||
if (state == null)
|
||||
return;
|
||||
m_States.StopState(index, state.isClone);
|
||||
if (!state.isClone)
|
||||
{
|
||||
RemoveClones(state);
|
||||
}
|
||||
}
|
||||
|
||||
public bool StopAll()
|
||||
{
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
DoStop(i);
|
||||
}
|
||||
|
||||
playable.SetDone(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsPlaying()
|
||||
{
|
||||
return m_States.AnyStatePlaying();
|
||||
}
|
||||
|
||||
public bool IsPlaying(string stateName)
|
||||
{
|
||||
StateInfo state = m_States.FindState(stateName);
|
||||
if (state == null)
|
||||
return false;
|
||||
|
||||
return state.enabled || IsClonePlaying(state);
|
||||
}
|
||||
|
||||
private bool IsClonePlaying(StateInfo state)
|
||||
{
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo otherState = m_States[i];
|
||||
if (otherState == null)
|
||||
continue;
|
||||
|
||||
if (otherState.isClone && otherState.enabled && otherState.parentState.index == state.index)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int GetClipCount()
|
||||
{
|
||||
int count=0;
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
if (m_States[i] != null)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private void SetupLerp(StateInfo state, float targetWeight, float time)
|
||||
{
|
||||
float travel = Mathf.Abs(state.weight - targetWeight);
|
||||
float newSpeed = time != 0f ? travel / time : Mathf.Infinity;
|
||||
|
||||
// If we're fading to the same target as before but slower, assume CrossFade was called multiple times and ignore new speed
|
||||
if (state.fading && Mathf.Approximately(state.targetWeight, targetWeight) && newSpeed < state.fadeSpeed)
|
||||
return;
|
||||
|
||||
state.FadeTo(targetWeight, newSpeed);
|
||||
}
|
||||
|
||||
private bool Crossfade(int index, float time)
|
||||
{
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
if (state == null)
|
||||
continue;
|
||||
|
||||
if (state.index == index)
|
||||
{
|
||||
m_States.EnableState(index);
|
||||
}
|
||||
|
||||
if (state.enabled == false)
|
||||
continue;
|
||||
|
||||
float targetWeight = state.index == index ? 1.0f : 0.0f;
|
||||
SetupLerp(state, targetWeight, time);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private StateInfo CloneState(int index)
|
||||
{
|
||||
StateInfo original = m_States[index];
|
||||
string newName = original.stateName + "Queued Clone";
|
||||
StateInfo clone = DoAddClip(newName, original.clip);
|
||||
clone.SetAsCloneOf(new StateHandle(this, original.index, original.playable));
|
||||
return clone;
|
||||
}
|
||||
|
||||
public bool Crossfade(string name, float time)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot crossfade to state with name {0} because there is no state with that name", name));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (time == 0f)
|
||||
return Play(state.index);
|
||||
|
||||
return Crossfade(state.index, time);
|
||||
}
|
||||
|
||||
public bool CrossfadeQueued(string name, float time, QueueMode queueMode)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot queue crossfade to state with name {0} because there is no state with that name", name));
|
||||
return false;
|
||||
}
|
||||
|
||||
return CrossfadeQueued(state.index, time, queueMode);
|
||||
}
|
||||
|
||||
private bool CrossfadeQueued(int index, float time, QueueMode queueMode)
|
||||
{
|
||||
StateInfo newState = CloneState(index);
|
||||
|
||||
if (queueMode == QueueMode.PlayNow)
|
||||
{
|
||||
Crossfade(newState.index, time);
|
||||
return true;
|
||||
}
|
||||
|
||||
m_StateQueue.AddLast(new QueuedState(StateInfoToHandle(newState), time));
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool Blend(int index, float targetWeight, float time)
|
||||
{
|
||||
StateInfo state = m_States[index];
|
||||
if (state.enabled == false)
|
||||
m_States.EnableState(index);
|
||||
|
||||
if (time == 0f)
|
||||
{
|
||||
state.ForceWeight(targetWeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupLerp(state, targetWeight, time);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Blend(string name, float targetWeight, float time)
|
||||
{
|
||||
StateInfo state = m_States.FindState(name);
|
||||
if (state == null)
|
||||
{
|
||||
Debug.LogError(string.Format("Cannot blend state with name {0} because there is no state with that name", name));
|
||||
return false;
|
||||
}
|
||||
|
||||
return Blend(state.index, targetWeight, time);
|
||||
}
|
||||
|
||||
public override void OnGraphStop(Playable playable)
|
||||
{
|
||||
//if the playable is not valid, then we are destroying, and our children won't be valid either
|
||||
if (!self.IsValid())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
if (state == null)
|
||||
continue;
|
||||
|
||||
if (state.fadeSpeed == 0f && state.targetWeight == 0f)
|
||||
{
|
||||
Playable input = m_Mixer.GetInput(state.index);
|
||||
if (!input.Equals(Playable.Null))
|
||||
{
|
||||
input.ResetTime(0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDoneStatus()
|
||||
{
|
||||
if (!m_States.AnyStatePlaying())
|
||||
{
|
||||
bool wasDone = playable.IsDone();
|
||||
playable.SetDone(true);
|
||||
if (!wasDone && onDone != null)
|
||||
{
|
||||
onDone();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CleanClonedStates()
|
||||
{
|
||||
for (int i = m_States.Count-1; i >= 0; i--)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
if (state == null)
|
||||
continue;
|
||||
|
||||
if (state.isReadyForCleanup)
|
||||
{
|
||||
Playable toDestroy = m_Mixer.GetInput(state.index);
|
||||
graph.Disconnect(m_Mixer, state.index);
|
||||
graph.DestroyPlayable(toDestroy);
|
||||
m_States.RemoveState(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DisconnectInput(int index)
|
||||
{
|
||||
if (keepStoppedPlayablesConnected)
|
||||
{
|
||||
m_States[index].Pause();
|
||||
}
|
||||
graph.Disconnect(m_Mixer, index);
|
||||
}
|
||||
|
||||
private void ConnectInput(int index)
|
||||
{
|
||||
StateInfo state = m_States[index];
|
||||
graph.Connect(state.playable, 0, m_Mixer, state.index);
|
||||
}
|
||||
|
||||
private void UpdateStates(float deltaTime)
|
||||
{
|
||||
bool mustUpdateWeights = false;
|
||||
float totalWeight = 0f;
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
|
||||
//Skip deleted states
|
||||
if (state == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Update crossfade weight
|
||||
if (state.fading)
|
||||
{
|
||||
state.SetWeight(Mathf.MoveTowards(state.weight, state.targetWeight, state.fadeSpeed *deltaTime));
|
||||
if (Mathf.Approximately(state.weight, state.targetWeight))
|
||||
{
|
||||
state.ForceWeight(state.targetWeight);
|
||||
if (state.weight == 0f)
|
||||
{
|
||||
state.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.enabledDirty)
|
||||
{
|
||||
if (state.enabled)
|
||||
state.Play();
|
||||
else
|
||||
state.Pause();
|
||||
|
||||
if (!keepStoppedPlayablesConnected)
|
||||
{
|
||||
Playable input = m_Mixer.GetInput(i);
|
||||
//if state is disabled but the corresponding input is connected, disconnect it
|
||||
if (input.IsValid() && !state.enabled)
|
||||
{
|
||||
DisconnectInput(i);
|
||||
}
|
||||
else if (state.enabled && !input.IsValid())
|
||||
{
|
||||
ConnectInput(state.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.enabled && state.wrapMode == WrapMode.Once)
|
||||
{
|
||||
bool stateIsDone = state.isDone;
|
||||
float speed = state.speed;
|
||||
float time = state.GetTime();
|
||||
float duration = state.playableDuration;
|
||||
|
||||
stateIsDone |= speed < 0f && time < 0f;
|
||||
stateIsDone |= speed >= 0f && time >= duration;
|
||||
if (stateIsDone)
|
||||
{
|
||||
state.Stop();
|
||||
state.Disable();
|
||||
if (!keepStoppedPlayablesConnected)
|
||||
DisconnectInput(state.index);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
totalWeight += state.weight;
|
||||
if (state.weightDirty)
|
||||
{
|
||||
mustUpdateWeights = true;
|
||||
}
|
||||
state.ResetDirtyFlags();
|
||||
}
|
||||
|
||||
if (mustUpdateWeights)
|
||||
{
|
||||
bool hasAnyWeight = totalWeight > 0.0f;
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
if (state == null)
|
||||
continue;
|
||||
|
||||
float weight = hasAnyWeight ? state.weight / totalWeight : 0.0f;
|
||||
m_Mixer.SetInputWeight(state.index, weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float CalculateQueueTimes()
|
||||
{
|
||||
float longestTime = -1f;
|
||||
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
//Skip deleted states
|
||||
if (state == null || !state.enabled || !state.playable.IsValid())
|
||||
continue;
|
||||
|
||||
if (state.wrapMode == WrapMode.Loop)
|
||||
{
|
||||
return Mathf.Infinity;
|
||||
}
|
||||
|
||||
float speed = state.speed;
|
||||
float stateTime = m_States.GetStateTime(state.index);
|
||||
float remainingTime;
|
||||
if (speed > 0 )
|
||||
{
|
||||
remainingTime = (state.clip.length - stateTime) / speed;
|
||||
}
|
||||
else if(speed < 0 )
|
||||
{
|
||||
remainingTime = (stateTime) / speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
remainingTime = Mathf.Infinity;
|
||||
}
|
||||
|
||||
if (remainingTime > longestTime)
|
||||
{
|
||||
longestTime = remainingTime;
|
||||
}
|
||||
}
|
||||
|
||||
return longestTime;
|
||||
}
|
||||
|
||||
private void ClearQueuedStates()
|
||||
{
|
||||
using (var it = m_StateQueue.GetEnumerator())
|
||||
{
|
||||
while (it.MoveNext())
|
||||
{
|
||||
QueuedState queuedState = it.Current;
|
||||
m_States.StopState(queuedState.state.index, true);
|
||||
}
|
||||
}
|
||||
m_StateQueue.Clear();
|
||||
}
|
||||
|
||||
private void UpdateQueuedStates()
|
||||
{
|
||||
bool mustCalculateQueueTimes = true;
|
||||
float remainingTime = -1f;
|
||||
|
||||
var it = m_StateQueue.First;
|
||||
while(it != null)
|
||||
{
|
||||
if (mustCalculateQueueTimes)
|
||||
{
|
||||
remainingTime = CalculateQueueTimes();
|
||||
mustCalculateQueueTimes = false;
|
||||
}
|
||||
|
||||
QueuedState queuedState = it.Value;
|
||||
|
||||
if (queuedState.fadeTime >= remainingTime)
|
||||
{
|
||||
Crossfade(queuedState.state.index, queuedState.fadeTime);
|
||||
mustCalculateQueueTimes = true;
|
||||
m_StateQueue.RemoveFirst();
|
||||
it = m_StateQueue.First;
|
||||
}
|
||||
else
|
||||
{
|
||||
it = it.Next;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void InvalidateStateTimes()
|
||||
{
|
||||
int count = m_States.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
if (state == null)
|
||||
continue;
|
||||
|
||||
state.InvalidateTime();
|
||||
}
|
||||
}
|
||||
|
||||
public override void PrepareFrame(Playable owner, FrameData data)
|
||||
{
|
||||
InvalidateStateTimes();
|
||||
|
||||
UpdateQueuedStates();
|
||||
|
||||
UpdateStates(data.deltaTime);
|
||||
|
||||
//Once everything is calculated, update done status
|
||||
UpdateDoneStatus();
|
||||
|
||||
CleanClonedStates();
|
||||
}
|
||||
|
||||
public bool ValidateInput(int index, Playable input)
|
||||
{
|
||||
if (!ValidateIndex(index))
|
||||
return false;
|
||||
|
||||
StateInfo state = m_States[index];
|
||||
if (state == null || !state.playable.IsValid() || state.playable.GetHandle() != input.GetHandle())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ValidateIndex(int index)
|
||||
{
|
||||
return index >= 0 && index < m_States.Count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e979d7febf8bb72429b0869d1791a78a
|
||||
timeCreated: 1493310304
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,718 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.Animations;
|
||||
using System;
|
||||
|
||||
public partial class SimpleAnimationPlayable : PlayableBehaviour
|
||||
{
|
||||
private int m_StatesVersion = 0;
|
||||
|
||||
private void InvalidateStates() { m_StatesVersion++; }
|
||||
private class StateEnumerable: IEnumerable<IState>
|
||||
{
|
||||
private SimpleAnimationPlayable m_Owner;
|
||||
public StateEnumerable(SimpleAnimationPlayable owner)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
public IEnumerator<IState> GetEnumerator()
|
||||
{
|
||||
return new StateEnumerator(m_Owner);
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return new StateEnumerator(m_Owner);
|
||||
}
|
||||
|
||||
class StateEnumerator : IEnumerator<IState>
|
||||
{
|
||||
private int m_Index = -1;
|
||||
private int m_Version;
|
||||
private SimpleAnimationPlayable m_Owner;
|
||||
public StateEnumerator(SimpleAnimationPlayable owner)
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Version = m_Owner.m_StatesVersion;
|
||||
Reset();
|
||||
}
|
||||
|
||||
private bool IsValid() { return m_Owner != null && m_Version == m_Owner.m_StatesVersion; }
|
||||
|
||||
IState GetCurrentHandle(int index)
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new InvalidOperationException("The collection has been modified, this Enumerator is invalid");
|
||||
|
||||
if (index < 0 || index >= m_Owner.m_States.Count)
|
||||
throw new InvalidOperationException("Enumerator is invalid");
|
||||
|
||||
StateInfo state = m_Owner.m_States[index];
|
||||
if (state == null)
|
||||
throw new InvalidOperationException("Enumerator is invalid");
|
||||
|
||||
return new StateHandle(m_Owner, state.index, state.playable);
|
||||
}
|
||||
|
||||
object IEnumerator.Current { get { return GetCurrentHandle(m_Index); } }
|
||||
|
||||
IState IEnumerator<IState>.Current { get { return GetCurrentHandle(m_Index); } }
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new InvalidOperationException("The collection has been modified, this Enumerator is invalid");
|
||||
|
||||
do
|
||||
{ m_Index++; } while (m_Index < m_Owner.m_States.Count && m_Owner.m_States[m_Index] == null);
|
||||
|
||||
return m_Index < m_Owner.m_States.Count;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new InvalidOperationException("The collection has been modified, this Enumerator is invalid");
|
||||
m_Index = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface IState
|
||||
{
|
||||
bool IsValid();
|
||||
|
||||
bool enabled { get; set; }
|
||||
|
||||
float time { get; set; }
|
||||
|
||||
float normalizedTime { get; set; }
|
||||
|
||||
float speed { get; set; }
|
||||
|
||||
string name { get; set; }
|
||||
|
||||
float weight { get; set; }
|
||||
|
||||
float length { get; }
|
||||
|
||||
AnimationClip clip { get; }
|
||||
|
||||
WrapMode wrapMode { get; }
|
||||
}
|
||||
|
||||
public class StateHandle : IState
|
||||
{
|
||||
public StateHandle(SimpleAnimationPlayable s, int index, Playable target)
|
||||
{
|
||||
m_Parent = s;
|
||||
m_Index = index;
|
||||
m_Target = target;
|
||||
}
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return m_Parent.ValidateInput(m_Index, m_Target);
|
||||
}
|
||||
|
||||
public bool enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
return m_Parent.m_States[m_Index].enabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
if (value)
|
||||
m_Parent.m_States.EnableState(m_Index);
|
||||
else
|
||||
m_Parent.m_States.DisableState(m_Index);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public float time
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
return m_Parent.m_States.GetStateTime(m_Index);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
m_Parent.m_States.SetStateTime(m_Index, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float normalizedTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
|
||||
float length = m_Parent.m_States.GetClipLength(m_Index);
|
||||
if (length == 0f)
|
||||
length = 1f;
|
||||
|
||||
return m_Parent.m_States.GetStateTime(m_Index) / length;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
|
||||
float length = m_Parent.m_States.GetClipLength(m_Index);
|
||||
if (length == 0f)
|
||||
length = 1f;
|
||||
|
||||
m_Parent.m_States.SetStateTime(m_Index, value *= length);
|
||||
}
|
||||
}
|
||||
|
||||
public float speed
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
return m_Parent.m_States.GetStateSpeed(m_Index);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
m_Parent.m_States.SetStateSpeed(m_Index, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string name
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
return m_Parent.m_States.GetStateName(m_Index);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
if (value == null)
|
||||
throw new System.ArgumentNullException("A null string is not a valid name");
|
||||
m_Parent.m_States.SetStateName(m_Index, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float weight
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
return m_Parent.m_States[m_Index].weight;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
if (value < 0)
|
||||
throw new System.ArgumentException("Weights cannot be negative");
|
||||
|
||||
m_Parent.m_States.SetInputWeight(m_Index, value);
|
||||
}
|
||||
}
|
||||
|
||||
public float length
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
return m_Parent.m_States.GetStateLength(m_Index);
|
||||
}
|
||||
}
|
||||
|
||||
public AnimationClip clip
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
return m_Parent.m_States.GetStateClip(m_Index);
|
||||
}
|
||||
}
|
||||
|
||||
public WrapMode wrapMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsValid())
|
||||
throw new System.InvalidOperationException("This StateHandle is not valid");
|
||||
return m_Parent.m_States.GetStateWrapMode(m_Index);
|
||||
}
|
||||
}
|
||||
|
||||
public int index { get { return m_Index; } }
|
||||
|
||||
private SimpleAnimationPlayable m_Parent;
|
||||
private int m_Index;
|
||||
private Playable m_Target;
|
||||
}
|
||||
|
||||
private class StateInfo
|
||||
{
|
||||
public void Initialize(string name, AnimationClip clip, WrapMode wrapMode)
|
||||
{
|
||||
m_StateName = name;
|
||||
m_Clip = clip;
|
||||
m_WrapMode = wrapMode;
|
||||
}
|
||||
|
||||
public float GetTime()
|
||||
{
|
||||
if (m_TimeIsUpToDate)
|
||||
return m_Time;
|
||||
|
||||
m_Time = (float)m_Playable.GetTime();
|
||||
m_TimeIsUpToDate = true;
|
||||
return m_Time;
|
||||
}
|
||||
|
||||
public void SetTime(float newTime)
|
||||
{
|
||||
m_Time = newTime;
|
||||
m_Playable.ResetTime(m_Time);
|
||||
m_Playable.SetDone(m_Time >= m_Playable.GetDuration());
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
if (m_Enabled)
|
||||
return;
|
||||
|
||||
m_EnabledDirty = true;
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
if (m_Enabled == false)
|
||||
return;
|
||||
|
||||
m_EnabledDirty = true;
|
||||
m_Enabled = false;
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
m_Playable.SetPlayState(PlayState.Paused);
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
m_Playable.SetPlayState(PlayState.Playing);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
m_FadeSpeed = 0f;
|
||||
ForceWeight(0.0f);
|
||||
Disable();
|
||||
SetTime(0.0f);
|
||||
m_Playable.SetDone(false);
|
||||
if (isClone)
|
||||
{
|
||||
m_ReadyForCleanup = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceWeight(float weight)
|
||||
{
|
||||
m_TargetWeight = weight;
|
||||
m_Fading = false;
|
||||
m_FadeSpeed = 0f;
|
||||
SetWeight(weight);
|
||||
}
|
||||
|
||||
public void SetWeight(float weight)
|
||||
{
|
||||
m_Weight = weight;
|
||||
m_WeightDirty = true;
|
||||
}
|
||||
|
||||
public void FadeTo(float weight, float speed)
|
||||
{
|
||||
m_Fading = Mathf.Abs(speed) > 0f;
|
||||
m_FadeSpeed = speed;
|
||||
m_TargetWeight = weight;
|
||||
}
|
||||
|
||||
public void DestroyPlayable()
|
||||
{
|
||||
if (m_Playable.IsValid())
|
||||
{
|
||||
m_Playable.GetGraph().DestroySubgraph(m_Playable);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAsCloneOf(StateHandle handle)
|
||||
{
|
||||
m_ParentState = handle;
|
||||
m_IsClone = true;
|
||||
}
|
||||
|
||||
public bool enabled
|
||||
{
|
||||
get { return m_Enabled; }
|
||||
}
|
||||
|
||||
private bool m_Enabled;
|
||||
|
||||
public int index
|
||||
{
|
||||
get { return m_Index; }
|
||||
set
|
||||
{
|
||||
Debug.Assert(m_Index == 0, "Should never reassign Index");
|
||||
m_Index = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int m_Index;
|
||||
|
||||
public string stateName
|
||||
{
|
||||
get { return m_StateName; }
|
||||
set { m_StateName = value; }
|
||||
}
|
||||
|
||||
private string m_StateName;
|
||||
|
||||
public bool fading
|
||||
{
|
||||
get { return m_Fading; }
|
||||
}
|
||||
|
||||
private bool m_Fading;
|
||||
|
||||
|
||||
private float m_Time;
|
||||
|
||||
public float targetWeight
|
||||
{
|
||||
get { return m_TargetWeight; }
|
||||
}
|
||||
|
||||
private float m_TargetWeight;
|
||||
|
||||
public float weight
|
||||
{
|
||||
get { return m_Weight; }
|
||||
}
|
||||
|
||||
float m_Weight;
|
||||
|
||||
public float fadeSpeed
|
||||
{
|
||||
get { return m_FadeSpeed; }
|
||||
}
|
||||
|
||||
float m_FadeSpeed;
|
||||
|
||||
public float speed
|
||||
{
|
||||
get { return (float)m_Playable.GetSpeed(); }
|
||||
set { m_Playable.SetSpeed(value); }
|
||||
}
|
||||
|
||||
public float playableDuration
|
||||
{
|
||||
get { return (float)m_Playable.GetDuration(); }
|
||||
}
|
||||
|
||||
public AnimationClip clip
|
||||
{
|
||||
get { return m_Clip; }
|
||||
}
|
||||
|
||||
private AnimationClip m_Clip;
|
||||
|
||||
public void SetPlayable(Playable playable)
|
||||
{
|
||||
m_Playable = playable;
|
||||
}
|
||||
|
||||
public bool isDone { get { return m_Playable.IsDone(); } }
|
||||
|
||||
public Playable playable
|
||||
{
|
||||
get { return m_Playable; }
|
||||
}
|
||||
|
||||
private Playable m_Playable;
|
||||
|
||||
public WrapMode wrapMode
|
||||
{
|
||||
get { return m_WrapMode; }
|
||||
}
|
||||
|
||||
private WrapMode m_WrapMode;
|
||||
|
||||
//Clone information
|
||||
public bool isClone
|
||||
{
|
||||
get { return m_IsClone; }
|
||||
}
|
||||
|
||||
private bool m_IsClone;
|
||||
|
||||
public bool isReadyForCleanup
|
||||
{
|
||||
get { return m_ReadyForCleanup; }
|
||||
}
|
||||
|
||||
private bool m_ReadyForCleanup;
|
||||
|
||||
public StateHandle parentState
|
||||
{
|
||||
get { return m_ParentState; }
|
||||
}
|
||||
|
||||
public StateHandle m_ParentState;
|
||||
|
||||
public bool enabledDirty { get { return m_EnabledDirty; } }
|
||||
public bool weightDirty { get { return m_WeightDirty; } }
|
||||
|
||||
public void ResetDirtyFlags()
|
||||
{
|
||||
m_EnabledDirty = false;
|
||||
m_WeightDirty = false;
|
||||
}
|
||||
|
||||
private bool m_WeightDirty;
|
||||
private bool m_EnabledDirty;
|
||||
|
||||
public void InvalidateTime() { m_TimeIsUpToDate = false; }
|
||||
private bool m_TimeIsUpToDate;
|
||||
}
|
||||
|
||||
private StateHandle StateInfoToHandle(StateInfo info)
|
||||
{
|
||||
return new StateHandle(this, info.index, info.playable);
|
||||
}
|
||||
|
||||
private class StateManagement
|
||||
{
|
||||
private List<StateInfo> m_States;
|
||||
|
||||
public int Count { get { return m_Count; } }
|
||||
|
||||
private int m_Count;
|
||||
|
||||
public StateInfo this[int i]
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_States[i];
|
||||
}
|
||||
}
|
||||
|
||||
public StateManagement()
|
||||
{
|
||||
m_States = new List<StateInfo>();
|
||||
}
|
||||
|
||||
public StateInfo InsertState()
|
||||
{
|
||||
StateInfo state = new StateInfo();
|
||||
|
||||
int firstAvailable = m_States.FindIndex(s => s == null);
|
||||
if (firstAvailable == -1)
|
||||
{
|
||||
firstAvailable = m_States.Count;
|
||||
m_States.Add(state);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_States.Insert(firstAvailable, state);
|
||||
}
|
||||
|
||||
state.index = firstAvailable;
|
||||
m_Count++;
|
||||
return state;
|
||||
}
|
||||
public bool AnyStatePlaying()
|
||||
{
|
||||
return m_States.FindIndex(s => s != null && s.enabled) != -1;
|
||||
}
|
||||
|
||||
public void RemoveState(int index)
|
||||
{
|
||||
StateInfo removed = m_States[index];
|
||||
m_States[index] = null;
|
||||
removed.DestroyPlayable();
|
||||
m_Count = m_States.Count;
|
||||
}
|
||||
|
||||
public bool RemoveClip(AnimationClip clip)
|
||||
{
|
||||
bool removed = false;
|
||||
for (int i = 0; i < m_States.Count; i++)
|
||||
{
|
||||
StateInfo state = m_States[i];
|
||||
if (state != null &&state.clip == clip)
|
||||
{
|
||||
RemoveState(i);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
public StateInfo FindState(string name)
|
||||
{
|
||||
int index = m_States.FindIndex(s => s != null && s.stateName == name);
|
||||
if (index == -1)
|
||||
return null;
|
||||
|
||||
return m_States[index];
|
||||
}
|
||||
|
||||
public void EnableState(int index)
|
||||
{
|
||||
StateInfo state = m_States[index];
|
||||
state.Enable();
|
||||
}
|
||||
|
||||
public void DisableState(int index)
|
||||
{
|
||||
StateInfo state = m_States[index];
|
||||
state.Disable();
|
||||
}
|
||||
|
||||
public void SetInputWeight(int index, float weight)
|
||||
{
|
||||
StateInfo state = m_States[index];
|
||||
state.SetWeight(weight);
|
||||
|
||||
}
|
||||
|
||||
public void SetStateTime(int index, float time)
|
||||
{
|
||||
StateInfo state = m_States[index];
|
||||
state.SetTime(time);
|
||||
}
|
||||
|
||||
public float GetStateTime(int index)
|
||||
{
|
||||
StateInfo state = m_States[index];
|
||||
return state.GetTime();
|
||||
}
|
||||
|
||||
public bool IsCloneOf(int potentialCloneIndex, int originalIndex)
|
||||
{
|
||||
StateInfo potentialClone = m_States[potentialCloneIndex];
|
||||
return potentialClone.isClone && potentialClone.parentState.index == originalIndex;
|
||||
}
|
||||
|
||||
public float GetStateSpeed(int index)
|
||||
{
|
||||
return m_States[index].speed;
|
||||
}
|
||||
public void SetStateSpeed(int index, float value)
|
||||
{
|
||||
m_States[index].speed = value;
|
||||
}
|
||||
|
||||
public float GetInputWeight(int index)
|
||||
{
|
||||
return m_States[index].weight;
|
||||
}
|
||||
|
||||
public float GetStateLength(int index)
|
||||
{
|
||||
AnimationClip clip = m_States[index].clip;
|
||||
if (clip == null)
|
||||
return 0f;
|
||||
float speed = m_States[index].speed;
|
||||
if (speed == 0f)
|
||||
return Mathf.Infinity;
|
||||
|
||||
return clip.length / speed;
|
||||
}
|
||||
|
||||
public float GetClipLength(int index)
|
||||
{
|
||||
AnimationClip clip = m_States[index].clip;
|
||||
if (clip == null)
|
||||
return 0f;
|
||||
|
||||
return clip.length;
|
||||
}
|
||||
|
||||
public float GetStatePlayableDuration(int index)
|
||||
{
|
||||
return m_States[index].playableDuration;
|
||||
}
|
||||
|
||||
public AnimationClip GetStateClip(int index)
|
||||
{
|
||||
return m_States[index].clip;
|
||||
}
|
||||
|
||||
public WrapMode GetStateWrapMode(int index)
|
||||
{
|
||||
return m_States[index].wrapMode;
|
||||
}
|
||||
|
||||
public string GetStateName(int index)
|
||||
{
|
||||
return m_States[index].stateName;
|
||||
}
|
||||
|
||||
public void SetStateName(int index, string name)
|
||||
{
|
||||
m_States[index].stateName = name;
|
||||
}
|
||||
|
||||
public void StopState(int index, bool cleanup)
|
||||
{
|
||||
if (cleanup)
|
||||
{
|
||||
RemoveState(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_States[index].Stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private struct QueuedState
|
||||
{
|
||||
public QueuedState(StateHandle s, float t)
|
||||
{
|
||||
state = s;
|
||||
fadeTime = t;
|
||||
}
|
||||
|
||||
public StateHandle state;
|
||||
public float fadeTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce4f5507fa3bef446a3981a7e6d2475e
|
||||
timeCreated: 1502387922
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
405
Assets/Scripts/SimpleAnimationComponent/SimpleAnimation_impl.cs
Normal file
405
Assets/Scripts/SimpleAnimationComponent/SimpleAnimation_impl.cs
Normal file
@@ -0,0 +1,405 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
[RequireComponent(typeof(Animator))]
|
||||
public partial class SimpleAnimation: MonoBehaviour, IAnimationClipSource
|
||||
{
|
||||
const string kDefaultStateName = "Default";
|
||||
private class StateEnumerable : IEnumerable<State>
|
||||
{
|
||||
private SimpleAnimation m_Owner;
|
||||
public StateEnumerable(SimpleAnimation owner)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
public IEnumerator<State> GetEnumerator()
|
||||
{
|
||||
return new StateEnumerator(m_Owner);
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return new StateEnumerator(m_Owner);
|
||||
}
|
||||
|
||||
class StateEnumerator : IEnumerator<State>
|
||||
{
|
||||
private SimpleAnimation m_Owner;
|
||||
private IEnumerator<SimpleAnimationPlayable.IState> m_Impl;
|
||||
public StateEnumerator(SimpleAnimation owner)
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Impl = m_Owner.m_Playable.GetStates().GetEnumerator();
|
||||
Reset();
|
||||
}
|
||||
|
||||
State GetCurrent()
|
||||
{
|
||||
return new StateImpl(m_Impl.Current, m_Owner);
|
||||
}
|
||||
|
||||
object IEnumerator.Current { get { return GetCurrent(); } }
|
||||
|
||||
State IEnumerator<State>.Current { get { return GetCurrent(); } }
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
return m_Impl.MoveNext();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Impl.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
private class StateImpl : State
|
||||
{
|
||||
public StateImpl(SimpleAnimationPlayable.IState handle, SimpleAnimation component)
|
||||
{
|
||||
m_StateHandle = handle;
|
||||
m_Component = component;
|
||||
}
|
||||
|
||||
private SimpleAnimationPlayable.IState m_StateHandle;
|
||||
private SimpleAnimation m_Component;
|
||||
|
||||
bool State.enabled
|
||||
{
|
||||
get { return m_StateHandle.enabled; }
|
||||
set
|
||||
{
|
||||
m_StateHandle.enabled = value;
|
||||
if (value)
|
||||
{
|
||||
m_Component.Kick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool State.isValid
|
||||
{
|
||||
get { return m_StateHandle.IsValid(); }
|
||||
}
|
||||
float State.time
|
||||
{
|
||||
get { return m_StateHandle.time; }
|
||||
set { m_StateHandle.time = value;
|
||||
m_Component.Kick(); }
|
||||
}
|
||||
float State.normalizedTime
|
||||
{
|
||||
get { return m_StateHandle.normalizedTime; }
|
||||
set { m_StateHandle.normalizedTime = value;
|
||||
m_Component.Kick();}
|
||||
}
|
||||
float State.speed
|
||||
{
|
||||
get { return m_StateHandle.speed; }
|
||||
set { m_StateHandle.speed = value;
|
||||
m_Component.Kick();}
|
||||
}
|
||||
|
||||
string State.name
|
||||
{
|
||||
get { return m_StateHandle.name; }
|
||||
set { m_StateHandle.name = value; }
|
||||
}
|
||||
float State.weight
|
||||
{
|
||||
get { return m_StateHandle.weight; }
|
||||
set { m_StateHandle.weight = value;
|
||||
m_Component.Kick();}
|
||||
}
|
||||
float State.length
|
||||
{
|
||||
get { return m_StateHandle.length; }
|
||||
}
|
||||
|
||||
AnimationClip State.clip
|
||||
{
|
||||
get { return m_StateHandle.clip; }
|
||||
}
|
||||
|
||||
WrapMode State.wrapMode
|
||||
{
|
||||
get { return m_StateHandle.wrapMode; }
|
||||
set { Debug.LogError("Not Implemented"); }
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class EditorState
|
||||
{
|
||||
public AnimationClip clip;
|
||||
public string name;
|
||||
public bool defaultState;
|
||||
}
|
||||
|
||||
protected void Kick()
|
||||
{
|
||||
if (!m_IsPlaying)
|
||||
{
|
||||
m_Graph.Play();
|
||||
m_IsPlaying = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected PlayableGraph m_Graph;
|
||||
protected PlayableHandle m_LayerMixer;
|
||||
protected PlayableHandle m_TransitionMixer;
|
||||
protected Animator m_Animator;
|
||||
protected bool m_Initialized;
|
||||
protected bool m_IsPlaying;
|
||||
|
||||
protected SimpleAnimationPlayable m_Playable;
|
||||
|
||||
[SerializeField]
|
||||
protected bool m_PlayAutomatically = true;
|
||||
|
||||
[SerializeField]
|
||||
protected bool m_AnimatePhysics = false;
|
||||
|
||||
[SerializeField]
|
||||
protected AnimatorCullingMode m_CullingMode = AnimatorCullingMode.CullUpdateTransforms;
|
||||
|
||||
[SerializeField]
|
||||
protected WrapMode m_WrapMode;
|
||||
|
||||
[SerializeField]
|
||||
protected AnimationClip m_Clip;
|
||||
|
||||
[SerializeField]
|
||||
private EditorState[] m_States;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
m_Graph.Play();
|
||||
if (m_PlayAutomatically)
|
||||
{
|
||||
Stop();
|
||||
Play();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnDisable()
|
||||
{
|
||||
if (m_Initialized)
|
||||
{
|
||||
Stop();
|
||||
m_Graph.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
if (m_Graph.IsValid())
|
||||
m_Graph.Destroy();
|
||||
|
||||
m_Initialized = false;
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
if (m_Initialized)
|
||||
return;
|
||||
|
||||
m_Animator = GetComponent<Animator>();
|
||||
m_Animator.updateMode = m_AnimatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal;
|
||||
m_Animator.cullingMode = m_CullingMode;
|
||||
m_Graph = PlayableGraph.Create();
|
||||
m_Graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
|
||||
SimpleAnimationPlayable template = new SimpleAnimationPlayable();
|
||||
|
||||
var playable = ScriptPlayable<SimpleAnimationPlayable>.Create(m_Graph, template, 1);
|
||||
m_Playable = playable.GetBehaviour();
|
||||
m_Playable.onDone += OnPlayableDone;
|
||||
if (m_States == null)
|
||||
{
|
||||
m_States = new EditorState[1];
|
||||
m_States[0] = new EditorState();
|
||||
m_States[0].defaultState = true;
|
||||
m_States[0].name = "Default";
|
||||
}
|
||||
|
||||
|
||||
if (m_States != null)
|
||||
{
|
||||
foreach (var state in m_States)
|
||||
{
|
||||
if (state.clip)
|
||||
{
|
||||
m_Playable.AddClip(state.clip, state.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EnsureDefaultStateExists();
|
||||
|
||||
AnimationPlayableUtilities.Play(m_Animator, m_Playable.playable, m_Graph);
|
||||
Play();
|
||||
Kick();
|
||||
m_Initialized = true;
|
||||
}
|
||||
|
||||
private void EnsureDefaultStateExists()
|
||||
{
|
||||
if ( m_Playable != null && m_Clip != null && m_Playable.GetState(kDefaultStateName) == null )
|
||||
{
|
||||
m_Playable.AddClip(m_Clip, kDefaultStateName);
|
||||
Kick();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
protected void OnDestroy()
|
||||
{
|
||||
if (m_Graph.IsValid())
|
||||
{
|
||||
m_Graph.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayableDone()
|
||||
{
|
||||
m_Graph.Stop();
|
||||
m_IsPlaying = false;
|
||||
}
|
||||
|
||||
private void RebuildStates()
|
||||
{
|
||||
var playableStates = GetStates();
|
||||
var list = new List<EditorState>();
|
||||
foreach (var state in playableStates)
|
||||
{
|
||||
var newState = new EditorState();
|
||||
newState.clip = state.clip;
|
||||
newState.name = state.name;
|
||||
list.Add(newState);
|
||||
}
|
||||
m_States = list.ToArray();
|
||||
}
|
||||
|
||||
EditorState CreateDefaultEditorState()
|
||||
{
|
||||
var defaultState = new EditorState();
|
||||
defaultState.name = "Default";
|
||||
defaultState.clip = m_Clip;
|
||||
defaultState.defaultState = true;
|
||||
|
||||
return defaultState;
|
||||
}
|
||||
|
||||
static void LegacyClipCheck(AnimationClip clip)
|
||||
{
|
||||
if (clip && clip.legacy)
|
||||
{
|
||||
throw new ArgumentException(string.Format("Legacy clip {0} cannot be used in this component. Set .legacy property to false before using this clip", clip));
|
||||
}
|
||||
}
|
||||
|
||||
void InvalidLegacyClipError(string clipName, string stateName)
|
||||
{
|
||||
Debug.LogErrorFormat(this.gameObject,"Animation clip {0} in state {1} is Legacy. Set clip.legacy to false, or reimport as Generic to use it with SimpleAnimationComponent", clipName, stateName);
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
//Don't mess with runtime data
|
||||
if (Application.isPlaying)
|
||||
return;
|
||||
|
||||
if (m_Clip && m_Clip.legacy)
|
||||
{
|
||||
Debug.LogErrorFormat(this.gameObject,"Animation clip {0} is Legacy. Set clip.legacy to false, or reimport as Generic to use it with SimpleAnimationComponent", m_Clip.name);
|
||||
m_Clip = null;
|
||||
}
|
||||
|
||||
//Ensure at least one state exists
|
||||
if (m_States == null || m_States.Length == 0)
|
||||
{
|
||||
m_States = new EditorState[1];
|
||||
}
|
||||
|
||||
//Create default state if it's null
|
||||
if (m_States[0] == null)
|
||||
{
|
||||
m_States[0] = CreateDefaultEditorState();
|
||||
}
|
||||
|
||||
//If first state is not the default state, create a new default state at index 0 and push back the rest
|
||||
if (m_States[0].defaultState == false || m_States[0].name != "Default")
|
||||
{
|
||||
var oldArray = m_States;
|
||||
m_States = new EditorState[oldArray.Length + 1];
|
||||
m_States[0] = CreateDefaultEditorState();
|
||||
oldArray.CopyTo(m_States, 1);
|
||||
}
|
||||
|
||||
//If default clip changed, update the default state
|
||||
if (m_States[0].clip != m_Clip)
|
||||
m_States[0].clip = m_Clip;
|
||||
|
||||
|
||||
//Make sure only one state is default
|
||||
for (int i = 1; i < m_States.Length; i++)
|
||||
{
|
||||
if (m_States[i] == null)
|
||||
{
|
||||
m_States[i] = new EditorState();
|
||||
}
|
||||
m_States[i].defaultState = false;
|
||||
}
|
||||
|
||||
//Ensure state names are unique
|
||||
int stateCount = m_States.Length;
|
||||
string[] names = new string[stateCount];
|
||||
|
||||
for (int i = 0; i < stateCount; i++)
|
||||
{
|
||||
EditorState state = m_States[i];
|
||||
if (state.name == "" && state.clip)
|
||||
{
|
||||
state.name = state.clip.name;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
state.name = ObjectNames.GetUniqueName(names, state.name);
|
||||
#endif
|
||||
names[i] = state.name;
|
||||
|
||||
if (state.clip && state.clip.legacy)
|
||||
{
|
||||
InvalidLegacyClipError(state.clip.name, state.name);
|
||||
state.clip = null;
|
||||
}
|
||||
}
|
||||
|
||||
m_Animator = GetComponent<Animator>();
|
||||
m_Animator.updateMode = m_AnimatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal;
|
||||
m_Animator.cullingMode = m_CullingMode;
|
||||
}
|
||||
|
||||
public void GetAnimationClips(List<AnimationClip> results)
|
||||
{
|
||||
foreach (var state in m_States)
|
||||
{
|
||||
if (state.clip != null)
|
||||
results.Add(state.clip);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11c2ad7a923243841ab35b83723a6473
|
||||
timeCreated: 1502394771
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/Scripts/SimpleAnimationComponent/Tests.meta
Normal file
10
Assets/Scripts/SimpleAnimationComponent/Tests.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52d9c3bfd6589ad4fad615672d33562b
|
||||
folderAsset: yes
|
||||
timeCreated: 1502464957
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
256
Assets/Scripts/SimpleAnimationComponent/Tests/AnimationProxy.cs
Normal file
256
Assets/Scripts/SimpleAnimationComponent/Tests/AnimationProxy.cs
Normal file
@@ -0,0 +1,256 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(Animation))]
|
||||
public class AnimationProxy : MonoBehaviour, IAnimation
|
||||
{
|
||||
|
||||
private class AnimationStateProxy: IAnimationState
|
||||
{
|
||||
public AnimationStateProxy(AnimationState state)
|
||||
{
|
||||
m_State = state;
|
||||
}
|
||||
|
||||
private AnimationState m_State;
|
||||
|
||||
public bool enabled
|
||||
{
|
||||
get { return m_State.enabled; }
|
||||
set { m_State.enabled = value; }
|
||||
}
|
||||
|
||||
public bool isValid
|
||||
{
|
||||
get { return (bool)m_State; }
|
||||
}
|
||||
|
||||
public float time
|
||||
{
|
||||
get { return m_State.time; }
|
||||
set { m_State.time = value; }
|
||||
}
|
||||
public float normalizedTime
|
||||
{
|
||||
get { return m_State.normalizedTime; }
|
||||
set { m_State.normalizedTime = value; }
|
||||
}
|
||||
public float speed
|
||||
{
|
||||
get { return m_State.speed; }
|
||||
set { m_State.speed = value; }
|
||||
}
|
||||
|
||||
public string name
|
||||
{
|
||||
get { return m_State.name; }
|
||||
set { m_State.name = value; }
|
||||
}
|
||||
public float weight
|
||||
{
|
||||
get { return m_State.weight; }
|
||||
set { m_State.weight = value; }
|
||||
}
|
||||
public float length
|
||||
{
|
||||
get { return m_State.length; }
|
||||
}
|
||||
|
||||
public AnimationClip clip
|
||||
{
|
||||
get { return m_State.clip; }
|
||||
}
|
||||
|
||||
public WrapMode wrapMode
|
||||
{
|
||||
get { return m_State.wrapMode; }
|
||||
set { m_State.wrapMode = value; }
|
||||
}
|
||||
}
|
||||
|
||||
private Animation m_Animation;
|
||||
|
||||
new private Animation animation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Animation == null)
|
||||
{
|
||||
m_Animation = GetComponent<Animation>();
|
||||
}
|
||||
return m_Animation;
|
||||
}
|
||||
}
|
||||
|
||||
public bool animatePhysics
|
||||
{
|
||||
get { return animation.animatePhysics; }
|
||||
set { animation.animatePhysics = value; }
|
||||
}
|
||||
|
||||
public AnimatorCullingMode cullingMode
|
||||
{
|
||||
get
|
||||
{
|
||||
AnimatorCullingMode mode;
|
||||
switch (animation.cullingType)
|
||||
{
|
||||
case AnimationCullingType.AlwaysAnimate:
|
||||
mode = AnimatorCullingMode.AlwaysAnimate;
|
||||
break;
|
||||
case AnimationCullingType.BasedOnRenderers:
|
||||
mode = AnimatorCullingMode.CullCompletely;
|
||||
break;
|
||||
default:
|
||||
mode = AnimatorCullingMode.CullUpdateTransforms;
|
||||
break;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
AnimationCullingType type;
|
||||
switch(value)
|
||||
{
|
||||
case AnimatorCullingMode.AlwaysAnimate:
|
||||
type = AnimationCullingType.AlwaysAnimate;
|
||||
break;
|
||||
default:
|
||||
type = AnimationCullingType.BasedOnRenderers;
|
||||
break;
|
||||
|
||||
}
|
||||
animation.cullingType = type;
|
||||
}
|
||||
}
|
||||
|
||||
public bool isPlaying
|
||||
{
|
||||
get { return animation.isPlaying; }
|
||||
}
|
||||
|
||||
public bool playAutomatically
|
||||
{
|
||||
get { return animation.playAutomatically; }
|
||||
set { animation.playAutomatically = value; }
|
||||
}
|
||||
|
||||
public WrapMode wrapMode
|
||||
{
|
||||
get { return animation.wrapMode; }
|
||||
set { animation.wrapMode = value; }
|
||||
}
|
||||
|
||||
public AnimationClip clip
|
||||
{
|
||||
get { return animation.clip; }
|
||||
set { animation.clip = value; }
|
||||
}
|
||||
|
||||
public bool usesLegacy
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
new public GameObject gameObject
|
||||
{
|
||||
get { return animation.gameObject; }
|
||||
}
|
||||
|
||||
public void AddClip(AnimationClip clip, string newName)
|
||||
{
|
||||
animation.AddClip(clip, newName);
|
||||
}
|
||||
|
||||
public void Blend(string state, float targetWeight, float fadeLength)
|
||||
{
|
||||
animation.Blend(state, targetWeight, fadeLength);
|
||||
}
|
||||
|
||||
public void CrossFade(string state, float fadeLength)
|
||||
{
|
||||
animation.CrossFade(state, fadeLength);
|
||||
}
|
||||
|
||||
public void CrossFadeQueued(string state, float fadeLength, QueueMode queueMode)
|
||||
{
|
||||
animation.CrossFadeQueued(state, fadeLength, queueMode);
|
||||
}
|
||||
|
||||
public int GetClipCount()
|
||||
{
|
||||
return animation.GetClipCount();
|
||||
}
|
||||
|
||||
public bool IsPlaying(string stateName)
|
||||
{
|
||||
return animation.IsPlaying(stateName);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
animation.Stop();
|
||||
}
|
||||
|
||||
public void Stop(string stateName)
|
||||
{
|
||||
animation.Stop(stateName);
|
||||
}
|
||||
|
||||
public void Sample()
|
||||
{
|
||||
animation.Sample();
|
||||
}
|
||||
|
||||
public bool Play()
|
||||
{
|
||||
return animation.Play();
|
||||
}
|
||||
|
||||
public bool Play(string stateName)
|
||||
{
|
||||
return animation.Play(stateName);
|
||||
}
|
||||
|
||||
public void PlayQueued(string stateName, QueueMode queueMode)
|
||||
{
|
||||
animation.PlayQueued(stateName, queueMode);
|
||||
}
|
||||
|
||||
public void RemoveClip(AnimationClip clip)
|
||||
{
|
||||
animation.RemoveClip(clip);
|
||||
}
|
||||
|
||||
public void RemoveClip(string stateName)
|
||||
{
|
||||
animation.RemoveClip(stateName);
|
||||
}
|
||||
|
||||
public void Rewind()
|
||||
{
|
||||
animation.Rewind();
|
||||
}
|
||||
|
||||
public void Rewind(string stateName)
|
||||
{
|
||||
animation.Rewind(stateName);
|
||||
}
|
||||
|
||||
public IAnimationState GetState(string stateName)
|
||||
{
|
||||
AnimationState state = animation[stateName];
|
||||
if (state != null)
|
||||
return new AnimationStateProxy(state);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IAnimationState this[string name]
|
||||
{
|
||||
get { return GetState(name); }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64de6b5accadb98478255b5777dbb960
|
||||
timeCreated: 1494556789
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
89
Assets/Scripts/SimpleAnimationComponent/Tests/IAnimation.cs
Normal file
89
Assets/Scripts/SimpleAnimationComponent/Tests/IAnimation.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public interface IAnimationState
|
||||
{
|
||||
bool enabled { get; set; }
|
||||
bool isValid { get; }
|
||||
float time { get; set; }
|
||||
float normalizedTime { get; set; }
|
||||
float speed { get; set; }
|
||||
string name { get; set; }
|
||||
float weight { get; set; }
|
||||
float length { get; }
|
||||
AnimationClip clip { get; }
|
||||
WrapMode wrapMode { get; set; }
|
||||
|
||||
}
|
||||
public interface IAnimation
|
||||
{
|
||||
//Should animations apply velocities to physics objects
|
||||
bool animatePhysics { get; set; }
|
||||
//How should animations mode updated based on renderer visibility
|
||||
AnimatorCullingMode cullingMode { get; set; }
|
||||
//Are we currently playing animations
|
||||
bool isPlaying { get;}
|
||||
//Should we start playing the default state
|
||||
bool playAutomatically { get; set; }
|
||||
//For clips where wrap mode is default, how should clips behave after they are done
|
||||
WrapMode wrapMode { get; set; }
|
||||
bool usesLegacy { get; }
|
||||
GameObject gameObject { get; }
|
||||
AnimationClip clip { get; set; }
|
||||
|
||||
//Adds a new state named newName, which uses the AnimationClip clip
|
||||
void AddClip(AnimationClip clip, string newName);
|
||||
|
||||
//Starts blending the state animation, towards weight targetWeight, fading over fadeLength seconds
|
||||
void Blend(string animation, float targetWeight, float fadeLength);
|
||||
|
||||
//Over the next fadeLength seconds, start fading in state animation, fading out all other states
|
||||
void CrossFade(string animation, float fadeLength);
|
||||
|
||||
//Queue a crossfade after the currently playing states are done playing.
|
||||
void CrossFadeQueued(string animation, float fadeLength, QueueMode queueMode);
|
||||
|
||||
//Gets the number of AnimationClips attached to the component
|
||||
int GetClipCount();
|
||||
|
||||
//Returns true if state stateName is playing
|
||||
bool IsPlaying(string stateName);
|
||||
|
||||
//Stops all playing animations on this component
|
||||
void Stop();
|
||||
|
||||
//Stops state named stateName
|
||||
void Stop(string stateName);
|
||||
|
||||
//Evaluates the animations at the current time
|
||||
void Sample();
|
||||
|
||||
//Plays the default clip. Returns false if there is no clip attached
|
||||
bool Play();
|
||||
|
||||
//Plays the specified clip. Returns false if the state does not exist
|
||||
bool Play(string stateName);
|
||||
|
||||
//Queue a Play after the current states are done playing
|
||||
void PlayQueued(string stateName, QueueMode queueMode);
|
||||
|
||||
//Removes the specified clip, and any states using it
|
||||
void RemoveClip(AnimationClip clip);
|
||||
|
||||
//Removes the specified state from the list of states,
|
||||
void RemoveClip(string stateName);
|
||||
|
||||
//Rewinds all states
|
||||
void Rewind();
|
||||
|
||||
//Rewinds state named stateName
|
||||
void Rewind(string stateName);
|
||||
|
||||
//Returns a handle on a state. Returns null if the state doesn't exist
|
||||
IAnimationState GetState(string stateName);
|
||||
|
||||
IAnimationState this[string name] { get; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c1b1cfcce5efef469b2b2392f34f6f8
|
||||
timeCreated: 1494550643
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: baf2d9b4464e59b4ab9cb1ecdc5dcb95
|
||||
folderAsset: yes
|
||||
timeCreated: 1499702943
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a1e5b1b5fa32b94498a6f27e9d63496
|
||||
folderAsset: yes
|
||||
timeCreated: 1502215731
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,316 @@
|
||||
%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: 8
|
||||
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, g: 0, b: 0, a: 1}
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_TemporalCoherenceThreshold: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 1
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 9
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_TextureWidth: 1024
|
||||
m_TextureHeight: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 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: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
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 &727728709
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 727728711}
|
||||
- component: {fileID: 727728710}
|
||||
m_Layer: 0
|
||||
m_Name: TestUI
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &727728710
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 727728709}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a9da7454dab41842ad0833069495d6c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Categories:
|
||||
- {fileID: 1526536085140382, guid: 876559ea1de191c4680a3ecd965eb5a6, type: 2}
|
||||
- {fileID: 1738818353288128, guid: 704824adecc7a1b439f4c34e90651320, type: 2}
|
||||
- {fileID: 1847196155820566, guid: 65148c2646c356b48b45a674d32f7085, type: 2}
|
||||
fps: 0
|
||||
fpssamples: 0
|
||||
numInstances: 10
|
||||
--- !u!4 &727728711
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 727728709}
|
||||
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 &1161389416
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1161389418}
|
||||
- component: {fileID: 1161389417}
|
||||
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 &1161389417
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161389416}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 8
|
||||
m_Type: 1
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
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_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_Lightmapping: 4
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &1161389418
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161389416}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &1578799488
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1578799493}
|
||||
- component: {fileID: 1578799492}
|
||||
- component: {fileID: 1578799491}
|
||||
- component: {fileID: 1578799490}
|
||||
- component: {fileID: 1578799489}
|
||||
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 &1578799489
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
m_ExtensionPropertyValues: []
|
||||
--- !u!124 &1578799490
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
--- !u!92 &1578799491
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1578799492
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
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_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
m_StereoMirrorMode: 0
|
||||
--- !u!4 &1578799493
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c25e0f0d6f1a4c9458fc5b1a381b764b
|
||||
timeCreated: 1499702978
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65148c2646c356b48b45a674d32f7085
|
||||
timeCreated: 1502220683
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,69 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: AndroidGenericAnim
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: 1107549521193886108}
|
||||
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: 9100000}
|
||||
--- !u!1102 &1102935785621315878
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Take 001
|
||||
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: 7400000, guid: 7eb8b94e211f70f44877f2fbe52f2e78, type: 3}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1107 &1107549521193886108
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102935785621315878}
|
||||
m_Position: {x: 200, y: 0, 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: 1102935785621315878}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92f729d0e503a0b479c3413fba6138c6
|
||||
timeCreated: 1502220628
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,433 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7eb8b94e211f70f44877f2fbe52f2e78
|
||||
timeCreated: 1502215789
|
||||
licenseType: Pro
|
||||
ModelImporter:
|
||||
serializedVersion: 22
|
||||
fileIDToRecycleName:
|
||||
100000: //RootNode
|
||||
100002: Body
|
||||
100004: Control_Dwn_Mouth
|
||||
100006: Control_DwnL_Mouth
|
||||
100008: Control_DwnR_Mouth
|
||||
100010: Control_Head
|
||||
100012: Control_Jaw
|
||||
100014: Control_L_Clavice
|
||||
100016: Control_L_Elbow
|
||||
100018: Control_L_Eyebrow_1
|
||||
100020: Control_L_Eyebrow_2
|
||||
100022: Control_L_Eyebrow_3
|
||||
100024: Control_L_EyeRot
|
||||
100026: Control_L_Face
|
||||
100028: Control_L_Finger_0
|
||||
100030: Control_L_Finger_0 1
|
||||
100032: Control_L_Finger_01
|
||||
100034: Control_L_Finger_01 1
|
||||
100036: Control_L_Finger_0_Master
|
||||
100038: Control_L_Finger_0_Master 1
|
||||
100040: Control_L_Finger_1
|
||||
100042: Control_L_Finger_1 1
|
||||
100044: Control_L_Finger_11
|
||||
100046: Control_L_Finger_11 1
|
||||
100048: Control_L_Finger_12
|
||||
100050: Control_L_Finger_12 1
|
||||
100052: Control_L_Finger_2
|
||||
100054: Control_L_Finger_2 1
|
||||
100056: Control_L_Finger_21
|
||||
100058: Control_L_Finger_21 1
|
||||
100060: Control_L_Finger_22
|
||||
100062: Control_L_Finger_22 1
|
||||
100064: Control_L_Finger_3
|
||||
100066: Control_L_Finger_3 1
|
||||
100068: Control_L_Finger_31
|
||||
100070: Control_L_Finger_31 1
|
||||
100072: Control_L_Finger_32
|
||||
100074: Control_L_Finger_32 1
|
||||
100076: Control_L_Finger_4
|
||||
100078: Control_L_Finger_4 1
|
||||
100080: Control_L_Finger_41
|
||||
100082: Control_L_Finger_41 1
|
||||
100084: Control_L_Finger_42
|
||||
100086: Control_L_Finger_42 1
|
||||
100088: Control_L_Foot
|
||||
100090: Control_L_FootRot
|
||||
100092: Control_L_Hand
|
||||
100094: Control_L_Mouth
|
||||
100096: Control_Neck
|
||||
100098: Control_R_Clavice
|
||||
100100: Control_R_Elbow
|
||||
100102: Control_R_Eyebrow_1
|
||||
100104: Control_R_Eyebrow_2
|
||||
100106: Control_R_Eyebrow_3
|
||||
100108: Control_R_EyeRot
|
||||
100110: Control_R_Face
|
||||
100112: Control_R_Foot
|
||||
100114: Control_R_FootRot
|
||||
100116: Control_R_Hand
|
||||
100118: Control_R_Mouth
|
||||
100120: Control_Root
|
||||
100122: Control_Spine_1
|
||||
100124: Control_Spine_2
|
||||
100126: Control_Spine_3
|
||||
100128: Control_Up_Mouth
|
||||
100130: Control_UpL_Mouth
|
||||
100132: Control_UpR_Mouth
|
||||
100134: Controls
|
||||
100136: Head1
|
||||
100138: Head2
|
||||
100140: Hips
|
||||
100142: IK_L_Foot
|
||||
100144: Ik_L_Hand
|
||||
100146: IK_L_Leg
|
||||
100148: IK_L_Toe
|
||||
100150: Ik_R_Foot
|
||||
100152: IK_R_Hand
|
||||
100154: Ik_R_Leg
|
||||
100156: Ik_R_Toe
|
||||
100158: Jaw1
|
||||
100160: Jaw2
|
||||
100162: L_Ankle_Pivot
|
||||
100164: L_HeelPeel
|
||||
100166: L_Swivel_Pivot
|
||||
100168: L_Toetap_Pivot
|
||||
100170: L_ToeTip_Pivot
|
||||
100172: LeftArm
|
||||
100174: LeftBrow1
|
||||
100176: LeftBrow2
|
||||
100178: LeftBrow3
|
||||
100180: LeftCheek
|
||||
100182: LeftEye
|
||||
100184: LeftFoot
|
||||
100186: LeftForeArm
|
||||
100188: LeftHand
|
||||
100190: LeftHandIndex1
|
||||
100192: LeftHandIndex2
|
||||
100194: LeftHandIndex3
|
||||
100196: LeftHandIndex4
|
||||
100198: LeftHandMiddle1
|
||||
100200: LeftHandMiddle2
|
||||
100202: LeftHandMiddle3
|
||||
100204: LeftHandMiddle4
|
||||
100206: LeftHandPinky1
|
||||
100208: LeftHandPinky2
|
||||
100210: LeftHandPinky3
|
||||
100212: LeftHandPinky4
|
||||
100214: LeftHandRing1
|
||||
100216: LeftHandRing2
|
||||
100218: LeftHandRing3
|
||||
100220: LeftHandRing4
|
||||
100222: LeftHandThumb1
|
||||
100224: LeftHandThumb2
|
||||
100226: LeftHandThumb3
|
||||
100228: LeftLeg
|
||||
100230: LeftMouth
|
||||
100232: LeftMouthLower
|
||||
100234: LeftMouthUpper
|
||||
100236: LeftShoulder
|
||||
100238: LeftToe1
|
||||
100240: LeftToe2
|
||||
100242: LeftUpLeg
|
||||
100244: Mesh
|
||||
100246: MouthLower
|
||||
100248: MouthUpper
|
||||
100250: Neck
|
||||
100252: R_Ankle_Pivot
|
||||
100254: R_HeelPeel_Pivot
|
||||
100256: R_Swivel_Pivot
|
||||
100258: R_ToeTap_Pivot
|
||||
100260: R_ToeTip_Pivot
|
||||
100262: RightArm
|
||||
100264: RightBrow1
|
||||
100266: RightBrow2
|
||||
100268: RightBrow3
|
||||
100270: RightCheek
|
||||
100272: RightEye
|
||||
100274: RightFoot
|
||||
100276: RightForeArm
|
||||
100278: RightHand
|
||||
100280: RightHandIndex1
|
||||
100282: RightHandIndex2
|
||||
100284: RightHandIndex3
|
||||
100286: RightHandIndex4
|
||||
100288: RightHandMiddle1
|
||||
100290: RightHandMiddle2
|
||||
100292: RightHandMiddle3
|
||||
100294: RightHandMiddle4
|
||||
100296: RightHandPinky1
|
||||
100298: RightHandPinky2
|
||||
100300: RightHandPinky3
|
||||
100302: RightHandPinky4
|
||||
100304: RightHandRing1
|
||||
100306: RightHandRing2
|
||||
100308: RightHandRing3
|
||||
100310: RightHandRing4
|
||||
100312: RightHandThumb1
|
||||
100314: RightHandThumb2
|
||||
100316: RightHandThumb3
|
||||
100318: RightLeg
|
||||
100320: RightMouth
|
||||
100322: RightMouthLower
|
||||
100324: RightMouthUpper
|
||||
100326: RightShoulder
|
||||
100328: RightToe1
|
||||
100330: RightToe2
|
||||
100332: RightUpLeg
|
||||
100334: Skeleton
|
||||
100336: Spine1
|
||||
100338: Spine2
|
||||
100340: Spine3
|
||||
400000: //RootNode
|
||||
400002: Body
|
||||
400004: Control_Dwn_Mouth
|
||||
400006: Control_DwnL_Mouth
|
||||
400008: Control_DwnR_Mouth
|
||||
400010: Control_Head
|
||||
400012: Control_Jaw
|
||||
400014: Control_L_Clavice
|
||||
400016: Control_L_Elbow
|
||||
400018: Control_L_Eyebrow_1
|
||||
400020: Control_L_Eyebrow_2
|
||||
400022: Control_L_Eyebrow_3
|
||||
400024: Control_L_EyeRot
|
||||
400026: Control_L_Face
|
||||
400028: Control_L_Finger_0
|
||||
400030: Control_L_Finger_0 1
|
||||
400032: Control_L_Finger_01
|
||||
400034: Control_L_Finger_01 1
|
||||
400036: Control_L_Finger_0_Master
|
||||
400038: Control_L_Finger_0_Master 1
|
||||
400040: Control_L_Finger_1
|
||||
400042: Control_L_Finger_1 1
|
||||
400044: Control_L_Finger_11
|
||||
400046: Control_L_Finger_11 1
|
||||
400048: Control_L_Finger_12
|
||||
400050: Control_L_Finger_12 1
|
||||
400052: Control_L_Finger_2
|
||||
400054: Control_L_Finger_2 1
|
||||
400056: Control_L_Finger_21
|
||||
400058: Control_L_Finger_21 1
|
||||
400060: Control_L_Finger_22
|
||||
400062: Control_L_Finger_22 1
|
||||
400064: Control_L_Finger_3
|
||||
400066: Control_L_Finger_3 1
|
||||
400068: Control_L_Finger_31
|
||||
400070: Control_L_Finger_31 1
|
||||
400072: Control_L_Finger_32
|
||||
400074: Control_L_Finger_32 1
|
||||
400076: Control_L_Finger_4
|
||||
400078: Control_L_Finger_4 1
|
||||
400080: Control_L_Finger_41
|
||||
400082: Control_L_Finger_41 1
|
||||
400084: Control_L_Finger_42
|
||||
400086: Control_L_Finger_42 1
|
||||
400088: Control_L_Foot
|
||||
400090: Control_L_FootRot
|
||||
400092: Control_L_Hand
|
||||
400094: Control_L_Mouth
|
||||
400096: Control_Neck
|
||||
400098: Control_R_Clavice
|
||||
400100: Control_R_Elbow
|
||||
400102: Control_R_Eyebrow_1
|
||||
400104: Control_R_Eyebrow_2
|
||||
400106: Control_R_Eyebrow_3
|
||||
400108: Control_R_EyeRot
|
||||
400110: Control_R_Face
|
||||
400112: Control_R_Foot
|
||||
400114: Control_R_FootRot
|
||||
400116: Control_R_Hand
|
||||
400118: Control_R_Mouth
|
||||
400120: Control_Root
|
||||
400122: Control_Spine_1
|
||||
400124: Control_Spine_2
|
||||
400126: Control_Spine_3
|
||||
400128: Control_Up_Mouth
|
||||
400130: Control_UpL_Mouth
|
||||
400132: Control_UpR_Mouth
|
||||
400134: Controls
|
||||
400136: Head1
|
||||
400138: Head2
|
||||
400140: Hips
|
||||
400142: IK_L_Foot
|
||||
400144: Ik_L_Hand
|
||||
400146: IK_L_Leg
|
||||
400148: IK_L_Toe
|
||||
400150: Ik_R_Foot
|
||||
400152: IK_R_Hand
|
||||
400154: Ik_R_Leg
|
||||
400156: Ik_R_Toe
|
||||
400158: Jaw1
|
||||
400160: Jaw2
|
||||
400162: L_Ankle_Pivot
|
||||
400164: L_HeelPeel
|
||||
400166: L_Swivel_Pivot
|
||||
400168: L_Toetap_Pivot
|
||||
400170: L_ToeTip_Pivot
|
||||
400172: LeftArm
|
||||
400174: LeftBrow1
|
||||
400176: LeftBrow2
|
||||
400178: LeftBrow3
|
||||
400180: LeftCheek
|
||||
400182: LeftEye
|
||||
400184: LeftFoot
|
||||
400186: LeftForeArm
|
||||
400188: LeftHand
|
||||
400190: LeftHandIndex1
|
||||
400192: LeftHandIndex2
|
||||
400194: LeftHandIndex3
|
||||
400196: LeftHandIndex4
|
||||
400198: LeftHandMiddle1
|
||||
400200: LeftHandMiddle2
|
||||
400202: LeftHandMiddle3
|
||||
400204: LeftHandMiddle4
|
||||
400206: LeftHandPinky1
|
||||
400208: LeftHandPinky2
|
||||
400210: LeftHandPinky3
|
||||
400212: LeftHandPinky4
|
||||
400214: LeftHandRing1
|
||||
400216: LeftHandRing2
|
||||
400218: LeftHandRing3
|
||||
400220: LeftHandRing4
|
||||
400222: LeftHandThumb1
|
||||
400224: LeftHandThumb2
|
||||
400226: LeftHandThumb3
|
||||
400228: LeftLeg
|
||||
400230: LeftMouth
|
||||
400232: LeftMouthLower
|
||||
400234: LeftMouthUpper
|
||||
400236: LeftShoulder
|
||||
400238: LeftToe1
|
||||
400240: LeftToe2
|
||||
400242: LeftUpLeg
|
||||
400244: Mesh
|
||||
400246: MouthLower
|
||||
400248: MouthUpper
|
||||
400250: Neck
|
||||
400252: R_Ankle_Pivot
|
||||
400254: R_HeelPeel_Pivot
|
||||
400256: R_Swivel_Pivot
|
||||
400258: R_ToeTap_Pivot
|
||||
400260: R_ToeTip_Pivot
|
||||
400262: RightArm
|
||||
400264: RightBrow1
|
||||
400266: RightBrow2
|
||||
400268: RightBrow3
|
||||
400270: RightCheek
|
||||
400272: RightEye
|
||||
400274: RightFoot
|
||||
400276: RightForeArm
|
||||
400278: RightHand
|
||||
400280: RightHandIndex1
|
||||
400282: RightHandIndex2
|
||||
400284: RightHandIndex3
|
||||
400286: RightHandIndex4
|
||||
400288: RightHandMiddle1
|
||||
400290: RightHandMiddle2
|
||||
400292: RightHandMiddle3
|
||||
400294: RightHandMiddle4
|
||||
400296: RightHandPinky1
|
||||
400298: RightHandPinky2
|
||||
400300: RightHandPinky3
|
||||
400302: RightHandPinky4
|
||||
400304: RightHandRing1
|
||||
400306: RightHandRing2
|
||||
400308: RightHandRing3
|
||||
400310: RightHandRing4
|
||||
400312: RightHandThumb1
|
||||
400314: RightHandThumb2
|
||||
400316: RightHandThumb3
|
||||
400318: RightLeg
|
||||
400320: RightMouth
|
||||
400322: RightMouthLower
|
||||
400324: RightMouthUpper
|
||||
400326: RightShoulder
|
||||
400328: RightToe1
|
||||
400330: RightToe2
|
||||
400332: RightUpLeg
|
||||
400334: Skeleton
|
||||
400336: Spine1
|
||||
400338: Spine2
|
||||
400340: Spine3
|
||||
2100000: Android_Walking_Android
|
||||
4300000: Body
|
||||
7400000: Take 001
|
||||
9500000: //RootNode
|
||||
13700000: Body
|
||||
externalObjects: {}
|
||||
materials:
|
||||
importMaterials: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
materialLocation: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
rigImportErrors:
|
||||
rigImportWarnings:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
importAnimatedCustomProperties: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
extraUserProperties: []
|
||||
clipAnimations: []
|
||||
isReadable: 1
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importVisibility: 1
|
||||
importBlendShapes: 1
|
||||
importCameras: 1
|
||||
importLights: 1
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
optimizeMeshForGPU: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
preserveHierarchy: 0
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
importAnimation: 1
|
||||
copyAvatar: 0
|
||||
humanDescription:
|
||||
serializedVersion: 2
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
rootMotionBoneName:
|
||||
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 0
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
animationType: 2
|
||||
humanoidOversampling: 1
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 876559ea1de191c4680a3ecd965eb5a6
|
||||
timeCreated: 1502220764
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,434 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 832c6aadeccb8324cb11d96f77cf9b74
|
||||
timeCreated: 1502215789
|
||||
licenseType: Pro
|
||||
ModelImporter:
|
||||
serializedVersion: 22
|
||||
fileIDToRecycleName:
|
||||
100000: //RootNode
|
||||
100002: Body
|
||||
100004: Control_Dwn_Mouth
|
||||
100006: Control_DwnL_Mouth
|
||||
100008: Control_DwnR_Mouth
|
||||
100010: Control_Head
|
||||
100012: Control_Jaw
|
||||
100014: Control_L_Clavice
|
||||
100016: Control_L_Elbow
|
||||
100018: Control_L_Eyebrow_1
|
||||
100020: Control_L_Eyebrow_2
|
||||
100022: Control_L_Eyebrow_3
|
||||
100024: Control_L_EyeRot
|
||||
100026: Control_L_Face
|
||||
100028: Control_L_Finger_0
|
||||
100030: Control_L_Finger_0 1
|
||||
100032: Control_L_Finger_01
|
||||
100034: Control_L_Finger_01 1
|
||||
100036: Control_L_Finger_0_Master
|
||||
100038: Control_L_Finger_0_Master 1
|
||||
100040: Control_L_Finger_1
|
||||
100042: Control_L_Finger_1 1
|
||||
100044: Control_L_Finger_11
|
||||
100046: Control_L_Finger_11 1
|
||||
100048: Control_L_Finger_12
|
||||
100050: Control_L_Finger_12 1
|
||||
100052: Control_L_Finger_2
|
||||
100054: Control_L_Finger_2 1
|
||||
100056: Control_L_Finger_21
|
||||
100058: Control_L_Finger_21 1
|
||||
100060: Control_L_Finger_22
|
||||
100062: Control_L_Finger_22 1
|
||||
100064: Control_L_Finger_3
|
||||
100066: Control_L_Finger_3 1
|
||||
100068: Control_L_Finger_31
|
||||
100070: Control_L_Finger_31 1
|
||||
100072: Control_L_Finger_32
|
||||
100074: Control_L_Finger_32 1
|
||||
100076: Control_L_Finger_4
|
||||
100078: Control_L_Finger_4 1
|
||||
100080: Control_L_Finger_41
|
||||
100082: Control_L_Finger_41 1
|
||||
100084: Control_L_Finger_42
|
||||
100086: Control_L_Finger_42 1
|
||||
100088: Control_L_Foot
|
||||
100090: Control_L_FootRot
|
||||
100092: Control_L_Hand
|
||||
100094: Control_L_Mouth
|
||||
100096: Control_Neck
|
||||
100098: Control_R_Clavice
|
||||
100100: Control_R_Elbow
|
||||
100102: Control_R_Eyebrow_1
|
||||
100104: Control_R_Eyebrow_2
|
||||
100106: Control_R_Eyebrow_3
|
||||
100108: Control_R_EyeRot
|
||||
100110: Control_R_Face
|
||||
100112: Control_R_Foot
|
||||
100114: Control_R_FootRot
|
||||
100116: Control_R_Hand
|
||||
100118: Control_R_Mouth
|
||||
100120: Control_Root
|
||||
100122: Control_Spine_1
|
||||
100124: Control_Spine_2
|
||||
100126: Control_Spine_3
|
||||
100128: Control_Up_Mouth
|
||||
100130: Control_UpL_Mouth
|
||||
100132: Control_UpR_Mouth
|
||||
100134: Controls
|
||||
100136: Head1
|
||||
100138: Head2
|
||||
100140: Hips
|
||||
100142: IK_L_Foot
|
||||
100144: Ik_L_Hand
|
||||
100146: IK_L_Leg
|
||||
100148: IK_L_Toe
|
||||
100150: Ik_R_Foot
|
||||
100152: IK_R_Hand
|
||||
100154: Ik_R_Leg
|
||||
100156: Ik_R_Toe
|
||||
100158: Jaw1
|
||||
100160: Jaw2
|
||||
100162: L_Ankle_Pivot
|
||||
100164: L_HeelPeel
|
||||
100166: L_Swivel_Pivot
|
||||
100168: L_Toetap_Pivot
|
||||
100170: L_ToeTip_Pivot
|
||||
100172: LeftArm
|
||||
100174: LeftBrow1
|
||||
100176: LeftBrow2
|
||||
100178: LeftBrow3
|
||||
100180: LeftCheek
|
||||
100182: LeftEye
|
||||
100184: LeftFoot
|
||||
100186: LeftForeArm
|
||||
100188: LeftHand
|
||||
100190: LeftHandIndex1
|
||||
100192: LeftHandIndex2
|
||||
100194: LeftHandIndex3
|
||||
100196: LeftHandIndex4
|
||||
100198: LeftHandMiddle1
|
||||
100200: LeftHandMiddle2
|
||||
100202: LeftHandMiddle3
|
||||
100204: LeftHandMiddle4
|
||||
100206: LeftHandPinky1
|
||||
100208: LeftHandPinky2
|
||||
100210: LeftHandPinky3
|
||||
100212: LeftHandPinky4
|
||||
100214: LeftHandRing1
|
||||
100216: LeftHandRing2
|
||||
100218: LeftHandRing3
|
||||
100220: LeftHandRing4
|
||||
100222: LeftHandThumb1
|
||||
100224: LeftHandThumb2
|
||||
100226: LeftHandThumb3
|
||||
100228: LeftLeg
|
||||
100230: LeftMouth
|
||||
100232: LeftMouthLower
|
||||
100234: LeftMouthUpper
|
||||
100236: LeftShoulder
|
||||
100238: LeftToe1
|
||||
100240: LeftToe2
|
||||
100242: LeftUpLeg
|
||||
100244: Mesh
|
||||
100246: MouthLower
|
||||
100248: MouthUpper
|
||||
100250: Neck
|
||||
100252: R_Ankle_Pivot
|
||||
100254: R_HeelPeel_Pivot
|
||||
100256: R_Swivel_Pivot
|
||||
100258: R_ToeTap_Pivot
|
||||
100260: R_ToeTip_Pivot
|
||||
100262: RightArm
|
||||
100264: RightBrow1
|
||||
100266: RightBrow2
|
||||
100268: RightBrow3
|
||||
100270: RightCheek
|
||||
100272: RightEye
|
||||
100274: RightFoot
|
||||
100276: RightForeArm
|
||||
100278: RightHand
|
||||
100280: RightHandIndex1
|
||||
100282: RightHandIndex2
|
||||
100284: RightHandIndex3
|
||||
100286: RightHandIndex4
|
||||
100288: RightHandMiddle1
|
||||
100290: RightHandMiddle2
|
||||
100292: RightHandMiddle3
|
||||
100294: RightHandMiddle4
|
||||
100296: RightHandPinky1
|
||||
100298: RightHandPinky2
|
||||
100300: RightHandPinky3
|
||||
100302: RightHandPinky4
|
||||
100304: RightHandRing1
|
||||
100306: RightHandRing2
|
||||
100308: RightHandRing3
|
||||
100310: RightHandRing4
|
||||
100312: RightHandThumb1
|
||||
100314: RightHandThumb2
|
||||
100316: RightHandThumb3
|
||||
100318: RightLeg
|
||||
100320: RightMouth
|
||||
100322: RightMouthLower
|
||||
100324: RightMouthUpper
|
||||
100326: RightShoulder
|
||||
100328: RightToe1
|
||||
100330: RightToe2
|
||||
100332: RightUpLeg
|
||||
100334: Skeleton
|
||||
100336: Spine1
|
||||
100338: Spine2
|
||||
100340: Spine3
|
||||
400000: //RootNode
|
||||
400002: Body
|
||||
400004: Control_Dwn_Mouth
|
||||
400006: Control_DwnL_Mouth
|
||||
400008: Control_DwnR_Mouth
|
||||
400010: Control_Head
|
||||
400012: Control_Jaw
|
||||
400014: Control_L_Clavice
|
||||
400016: Control_L_Elbow
|
||||
400018: Control_L_Eyebrow_1
|
||||
400020: Control_L_Eyebrow_2
|
||||
400022: Control_L_Eyebrow_3
|
||||
400024: Control_L_EyeRot
|
||||
400026: Control_L_Face
|
||||
400028: Control_L_Finger_0
|
||||
400030: Control_L_Finger_0 1
|
||||
400032: Control_L_Finger_01
|
||||
400034: Control_L_Finger_01 1
|
||||
400036: Control_L_Finger_0_Master
|
||||
400038: Control_L_Finger_0_Master 1
|
||||
400040: Control_L_Finger_1
|
||||
400042: Control_L_Finger_1 1
|
||||
400044: Control_L_Finger_11
|
||||
400046: Control_L_Finger_11 1
|
||||
400048: Control_L_Finger_12
|
||||
400050: Control_L_Finger_12 1
|
||||
400052: Control_L_Finger_2
|
||||
400054: Control_L_Finger_2 1
|
||||
400056: Control_L_Finger_21
|
||||
400058: Control_L_Finger_21 1
|
||||
400060: Control_L_Finger_22
|
||||
400062: Control_L_Finger_22 1
|
||||
400064: Control_L_Finger_3
|
||||
400066: Control_L_Finger_3 1
|
||||
400068: Control_L_Finger_31
|
||||
400070: Control_L_Finger_31 1
|
||||
400072: Control_L_Finger_32
|
||||
400074: Control_L_Finger_32 1
|
||||
400076: Control_L_Finger_4
|
||||
400078: Control_L_Finger_4 1
|
||||
400080: Control_L_Finger_41
|
||||
400082: Control_L_Finger_41 1
|
||||
400084: Control_L_Finger_42
|
||||
400086: Control_L_Finger_42 1
|
||||
400088: Control_L_Foot
|
||||
400090: Control_L_FootRot
|
||||
400092: Control_L_Hand
|
||||
400094: Control_L_Mouth
|
||||
400096: Control_Neck
|
||||
400098: Control_R_Clavice
|
||||
400100: Control_R_Elbow
|
||||
400102: Control_R_Eyebrow_1
|
||||
400104: Control_R_Eyebrow_2
|
||||
400106: Control_R_Eyebrow_3
|
||||
400108: Control_R_EyeRot
|
||||
400110: Control_R_Face
|
||||
400112: Control_R_Foot
|
||||
400114: Control_R_FootRot
|
||||
400116: Control_R_Hand
|
||||
400118: Control_R_Mouth
|
||||
400120: Control_Root
|
||||
400122: Control_Spine_1
|
||||
400124: Control_Spine_2
|
||||
400126: Control_Spine_3
|
||||
400128: Control_Up_Mouth
|
||||
400130: Control_UpL_Mouth
|
||||
400132: Control_UpR_Mouth
|
||||
400134: Controls
|
||||
400136: Head1
|
||||
400138: Head2
|
||||
400140: Hips
|
||||
400142: IK_L_Foot
|
||||
400144: Ik_L_Hand
|
||||
400146: IK_L_Leg
|
||||
400148: IK_L_Toe
|
||||
400150: Ik_R_Foot
|
||||
400152: IK_R_Hand
|
||||
400154: Ik_R_Leg
|
||||
400156: Ik_R_Toe
|
||||
400158: Jaw1
|
||||
400160: Jaw2
|
||||
400162: L_Ankle_Pivot
|
||||
400164: L_HeelPeel
|
||||
400166: L_Swivel_Pivot
|
||||
400168: L_Toetap_Pivot
|
||||
400170: L_ToeTip_Pivot
|
||||
400172: LeftArm
|
||||
400174: LeftBrow1
|
||||
400176: LeftBrow2
|
||||
400178: LeftBrow3
|
||||
400180: LeftCheek
|
||||
400182: LeftEye
|
||||
400184: LeftFoot
|
||||
400186: LeftForeArm
|
||||
400188: LeftHand
|
||||
400190: LeftHandIndex1
|
||||
400192: LeftHandIndex2
|
||||
400194: LeftHandIndex3
|
||||
400196: LeftHandIndex4
|
||||
400198: LeftHandMiddle1
|
||||
400200: LeftHandMiddle2
|
||||
400202: LeftHandMiddle3
|
||||
400204: LeftHandMiddle4
|
||||
400206: LeftHandPinky1
|
||||
400208: LeftHandPinky2
|
||||
400210: LeftHandPinky3
|
||||
400212: LeftHandPinky4
|
||||
400214: LeftHandRing1
|
||||
400216: LeftHandRing2
|
||||
400218: LeftHandRing3
|
||||
400220: LeftHandRing4
|
||||
400222: LeftHandThumb1
|
||||
400224: LeftHandThumb2
|
||||
400226: LeftHandThumb3
|
||||
400228: LeftLeg
|
||||
400230: LeftMouth
|
||||
400232: LeftMouthLower
|
||||
400234: LeftMouthUpper
|
||||
400236: LeftShoulder
|
||||
400238: LeftToe1
|
||||
400240: LeftToe2
|
||||
400242: LeftUpLeg
|
||||
400244: Mesh
|
||||
400246: MouthLower
|
||||
400248: MouthUpper
|
||||
400250: Neck
|
||||
400252: R_Ankle_Pivot
|
||||
400254: R_HeelPeel_Pivot
|
||||
400256: R_Swivel_Pivot
|
||||
400258: R_ToeTap_Pivot
|
||||
400260: R_ToeTip_Pivot
|
||||
400262: RightArm
|
||||
400264: RightBrow1
|
||||
400266: RightBrow2
|
||||
400268: RightBrow3
|
||||
400270: RightCheek
|
||||
400272: RightEye
|
||||
400274: RightFoot
|
||||
400276: RightForeArm
|
||||
400278: RightHand
|
||||
400280: RightHandIndex1
|
||||
400282: RightHandIndex2
|
||||
400284: RightHandIndex3
|
||||
400286: RightHandIndex4
|
||||
400288: RightHandMiddle1
|
||||
400290: RightHandMiddle2
|
||||
400292: RightHandMiddle3
|
||||
400294: RightHandMiddle4
|
||||
400296: RightHandPinky1
|
||||
400298: RightHandPinky2
|
||||
400300: RightHandPinky3
|
||||
400302: RightHandPinky4
|
||||
400304: RightHandRing1
|
||||
400306: RightHandRing2
|
||||
400308: RightHandRing3
|
||||
400310: RightHandRing4
|
||||
400312: RightHandThumb1
|
||||
400314: RightHandThumb2
|
||||
400316: RightHandThumb3
|
||||
400318: RightLeg
|
||||
400320: RightMouth
|
||||
400322: RightMouthLower
|
||||
400324: RightMouthUpper
|
||||
400326: RightShoulder
|
||||
400328: RightToe1
|
||||
400330: RightToe2
|
||||
400332: RightUpLeg
|
||||
400334: Skeleton
|
||||
400336: Spine1
|
||||
400338: Spine2
|
||||
400340: Spine3
|
||||
2100000: Android_Walking_Android
|
||||
4300000: Body
|
||||
7400000: Take 001
|
||||
9500000: //RootNode
|
||||
11100000: //RootNode
|
||||
13700000: Body
|
||||
externalObjects: {}
|
||||
materials:
|
||||
importMaterials: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
materialLocation: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
rigImportErrors:
|
||||
rigImportWarnings:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
importAnimatedCustomProperties: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
extraUserProperties: []
|
||||
clipAnimations: []
|
||||
isReadable: 1
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importVisibility: 1
|
||||
importBlendShapes: 1
|
||||
importCameras: 1
|
||||
importLights: 1
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
optimizeMeshForGPU: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
preserveHierarchy: 0
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
importAnimation: 1
|
||||
copyAvatar: 0
|
||||
humanDescription:
|
||||
serializedVersion: 2
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
rootMotionBoneName:
|
||||
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 1
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
animationType: 1
|
||||
humanoidOversampling: 1
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 704824adecc7a1b439f4c34e90651320
|
||||
timeCreated: 1502220731
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e44854009789604f9315bbdb97b6923
|
||||
folderAsset: yes
|
||||
timeCreated: 1502215731
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b957f0ccd368efa4eaa54c5b97bd139d
|
||||
timeCreated: 1502220683
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,97 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: AndroidGenericAnimWithTransitions
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: 1107549521193886108}
|
||||
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: 9100000}
|
||||
--- !u!1102 &1102335610593448972
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 3
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: B
|
||||
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: 7400000, guid: 7eb8b94e211f70f44877f2fbe52f2e78, type: 3}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1102 &1102935785621315878
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: A
|
||||
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: 7400000, guid: 7eb8b94e211f70f44877f2fbe52f2e78, type: 3}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1107 &1107549521193886108
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102935785621315878}
|
||||
m_Position: {x: 264, y: 24, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102335610593448972}
|
||||
m_Position: {x: 564, y: 24, 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: 1102935785621315878}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53f5d4ad902e961429b0cb91f1634d17
|
||||
timeCreated: 1502220628
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6d39a8362ca1b649a555d76ee5858e4
|
||||
timeCreated: 1502220764
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a860fdcd8b5e1184c9f7a85a5324277a
|
||||
timeCreated: 1502220731
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SimpleAnimationTransitions : MonoBehaviour {
|
||||
enum AnimationType
|
||||
{
|
||||
Legacy,
|
||||
SimplePlayable,
|
||||
StateMachine
|
||||
}
|
||||
AnimationType animationType;
|
||||
SimpleAnimation simpleAnimation;
|
||||
public AnimationClip clip;
|
||||
// Use this for initialization
|
||||
IEnumerator Start ()
|
||||
{
|
||||
var animationComponent = GetComponent<Animation>();
|
||||
var animatorComponent = GetComponent<Animator>();
|
||||
var simpleAnimationComponent = GetComponent<SimpleAnimation>();
|
||||
if (animationComponent)
|
||||
animationType = AnimationType.Legacy;
|
||||
else if (simpleAnimationComponent)
|
||||
animationType = AnimationType.SimplePlayable;
|
||||
else
|
||||
animationType = AnimationType.StateMachine;
|
||||
|
||||
|
||||
switch (animationType)
|
||||
{
|
||||
case AnimationType.Legacy:
|
||||
animationComponent.AddClip(clip, "A");
|
||||
animationComponent.AddClip(clip, "B");
|
||||
break;
|
||||
case AnimationType.SimplePlayable:
|
||||
simpleAnimationComponent.AddClip(clip, "A");
|
||||
simpleAnimationComponent.AddClip(clip, "B");
|
||||
break;
|
||||
case AnimationType.StateMachine:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
while(true)
|
||||
{
|
||||
switch (animationType)
|
||||
{
|
||||
case AnimationType.Legacy:
|
||||
animationComponent.Play("A");
|
||||
break;
|
||||
case AnimationType.SimplePlayable:
|
||||
simpleAnimationComponent.Play("A");
|
||||
break;
|
||||
case AnimationType.StateMachine:
|
||||
animatorComponent.Play("A");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
||||
switch (animationType)
|
||||
{
|
||||
case AnimationType.Legacy:
|
||||
animationComponent.Play("B");
|
||||
break;
|
||||
case AnimationType.SimplePlayable:
|
||||
simpleAnimationComponent.Play("B");
|
||||
break;
|
||||
case AnimationType.StateMachine:
|
||||
animatorComponent.Play("B");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98e0400eb48644f44bbbae58412a4dda
|
||||
timeCreated: 1502302146
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,316 @@
|
||||
%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: 8
|
||||
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, g: 0, b: 0, a: 1}
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_TemporalCoherenceThreshold: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 1
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 9
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_TextureWidth: 1024
|
||||
m_TextureHeight: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 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: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
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 &727728709
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 727728711}
|
||||
- component: {fileID: 727728710}
|
||||
m_Layer: 0
|
||||
m_Name: TestUI
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &727728710
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 727728709}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a9da7454dab41842ad0833069495d6c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Categories:
|
||||
- {fileID: 1526536085140382, guid: b6d39a8362ca1b649a555d76ee5858e4, type: 2}
|
||||
- {fileID: 1738818353288128, guid: a860fdcd8b5e1184c9f7a85a5324277a, type: 2}
|
||||
- {fileID: 1847196155820566, guid: b957f0ccd368efa4eaa54c5b97bd139d, type: 2}
|
||||
fps: 0
|
||||
fpssamples: 0
|
||||
numInstances: 100
|
||||
--- !u!4 &727728711
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 727728709}
|
||||
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 &1161389416
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1161389418}
|
||||
- component: {fileID: 1161389417}
|
||||
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 &1161389417
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161389416}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 8
|
||||
m_Type: 1
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
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_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_Lightmapping: 4
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &1161389418
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161389416}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &1578799488
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1578799493}
|
||||
- component: {fileID: 1578799492}
|
||||
- component: {fileID: 1578799491}
|
||||
- component: {fileID: 1578799490}
|
||||
- component: {fileID: 1578799489}
|
||||
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 &1578799489
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
m_ExtensionPropertyValues: []
|
||||
--- !u!124 &1578799490
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
--- !u!92 &1578799491
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1578799492
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
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_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
m_StereoMirrorMode: 0
|
||||
--- !u!4 &1578799493
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3575b024195d20d4f844ec417f241fb7
|
||||
timeCreated: 1499702978
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ddcd3ba40b3ab54a9fdf434e653ab74
|
||||
folderAsset: yes
|
||||
timeCreated: 1499724042
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,316 @@
|
||||
%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: 8
|
||||
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, g: 0, b: 0, a: 1}
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_TemporalCoherenceThreshold: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 1
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 9
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_TextureWidth: 1024
|
||||
m_TextureHeight: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 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: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
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 &727728709
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 727728711}
|
||||
- component: {fileID: 727728710}
|
||||
m_Layer: 0
|
||||
m_Name: TestUI
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &727728710
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 727728709}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a9da7454dab41842ad0833069495d6c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Categories:
|
||||
- {fileID: 1538064715297094, guid: e1ffdb48f32e88844b033116595a2e73, type: 2}
|
||||
- {fileID: 1364076715903534, guid: 35404a7e2d31d61408685b01188d5d5d, type: 2}
|
||||
- {fileID: 1341967805661704, guid: d7d944dacc227454f9f7b182c0f79331, type: 2}
|
||||
fps: 0
|
||||
fpssamples: 0
|
||||
numInstances: 1000
|
||||
--- !u!4 &727728711
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 727728709}
|
||||
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 &1161389416
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1161389418}
|
||||
- component: {fileID: 1161389417}
|
||||
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 &1161389417
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161389416}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 8
|
||||
m_Type: 1
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
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_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_Lightmapping: 4
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &1161389418
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1161389416}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &1578799488
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 1578799493}
|
||||
- component: {fileID: 1578799492}
|
||||
- component: {fileID: 1578799491}
|
||||
- component: {fileID: 1578799490}
|
||||
- component: {fileID: 1578799489}
|
||||
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 &1578799489
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
m_ExtensionPropertyValues: []
|
||||
--- !u!124 &1578799490
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
--- !u!92 &1578799491
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1578799492
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
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_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
m_StereoMirrorMode: 0
|
||||
--- !u!4 &1578799493
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1578799488}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a2d20e4a0303bb419e4c6b258bb5399
|
||||
timeCreated: 1499702978
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b471140328b267744b550b21bbdfa42b
|
||||
timeCreated: 1499719813
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,69 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: RotateAnimatorOnce
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: 1107379810546856550}
|
||||
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: 9100000}
|
||||
--- !u!1102 &1102895856690584682
|
||||
AnimatorState:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: RotateAnimatorOnce
|
||||
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: 7400000, guid: b471140328b267744b550b21bbdfa42b, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1107 &1107379810546856550
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102895856690584682}
|
||||
m_Position: {x: 318, y: 11, 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: 1102895856690584682}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f266c6e5fbe362445b5be495aa420638
|
||||
timeCreated: 1499716723
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,115 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1341967805661704}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1341967805661704
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4645385144936590}
|
||||
- component: {fileID: 33230436311820440}
|
||||
- component: {fileID: 65023472968491936}
|
||||
- component: {fileID: 23015787009599532}
|
||||
- component: {fileID: 95272312736588580}
|
||||
m_Layer: 0
|
||||
m_Name: RotateAnimatorOnce
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4645385144936590
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1341967805661704}
|
||||
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: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &23015787009599532
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1341967805661704}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 1
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchSeams: 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 &33230436311820440
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1341967805661704}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!65 &65023472968491936
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1341967805661704}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!95 &95272312736588580
|
||||
Animator:
|
||||
serializedVersion: 3
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1341967805661704}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: f266c6e5fbe362445b5be495aa420638, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7d944dacc227454f9f7b182c0f79331
|
||||
timeCreated: 1499724134
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 842d8f6b74f9b0d4daaed5496f9d5bc2
|
||||
timeCreated: 1499719813
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,113 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1538064715297094}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1538064715297094
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4116082255304898}
|
||||
- component: {fileID: 33160734106104084}
|
||||
- component: {fileID: 65449479563447892}
|
||||
- component: {fileID: 23484575331995812}
|
||||
- component: {fileID: 111682082938616202}
|
||||
m_Layer: 0
|
||||
m_Name: RotateLegacyOnce
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4116082255304898
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1538064715297094}
|
||||
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: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &23484575331995812
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1538064715297094}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 1
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchSeams: 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 &33160734106104084
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1538064715297094}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!65 &65449479563447892
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1538064715297094}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!111 &111682082938616202
|
||||
Animation:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1538064715297094}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Animation: {fileID: 7400000, guid: 842d8f6b74f9b0d4daaed5496f9d5bc2, type: 2}
|
||||
m_Animations:
|
||||
- {fileID: 7400000, guid: 842d8f6b74f9b0d4daaed5496f9d5bc2, type: 2}
|
||||
m_WrapMode: 0
|
||||
m_PlayAutomatically: 1
|
||||
m_AnimatePhysics: 0
|
||||
m_CullingType: 0
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1ffdb48f32e88844b033116595a2e73
|
||||
timeCreated: 1499724088
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,129 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1364076715903534}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1364076715903534
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4571146370560290}
|
||||
- component: {fileID: 33812149907794824}
|
||||
- component: {fileID: 65689843090748916}
|
||||
- component: {fileID: 23817231451851486}
|
||||
- component: {fileID: 95548609735069730}
|
||||
- component: {fileID: 114409330083510338}
|
||||
m_Layer: 0
|
||||
m_Name: RotateSimpleAnimationOnce
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4571146370560290
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1364076715903534}
|
||||
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: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &23817231451851486
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1364076715903534}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 1
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchSeams: 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 &33812149907794824
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1364076715903534}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!65 &65689843090748916
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1364076715903534}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!95 &95548609735069730
|
||||
Animator:
|
||||
serializedVersion: 3
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1364076715903534}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 0}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
--- !u!114 &114409330083510338
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1364076715903534}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3759e2aae0f7b9a47bb98fc64bf3c543, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
clips: []
|
||||
m_Clip: {fileID: 7400000, guid: b471140328b267744b550b21bbdfa42b, type: 2}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35404a7e2d31d61408685b01188d5d5d
|
||||
timeCreated: 1499724112
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0868571ae84d814da290ff650e4ecb5
|
||||
folderAsset: yes
|
||||
timeCreated: 1499724018
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9b50f078b62d8e449242b537084fdd2
|
||||
timeCreated: 1499703149
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2eec5327fcbca549b19a79fcc523aa2
|
||||
timeCreated: 1499703092
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c83eadf2c665b664a8a216632ee3047c
|
||||
timeCreated: 1499702978
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class TestUI : MonoBehaviour {
|
||||
|
||||
public GameObject[] Categories;
|
||||
public float fps;
|
||||
public int fpssamples;
|
||||
public int numInstances;
|
||||
private List<GameObject> m_Instances;
|
||||
// Use this for initialization
|
||||
void Start ()
|
||||
{
|
||||
m_Instances = new List<GameObject>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (Categories == null)
|
||||
return;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
foreach(var category in Categories)
|
||||
{
|
||||
if (GUILayout.Button(category.name))
|
||||
{
|
||||
fpssamples = 0;
|
||||
foreach (var instance in m_Instances)
|
||||
{
|
||||
Destroy(instance);
|
||||
}
|
||||
|
||||
for (int i = 0; i < numInstances; i++)
|
||||
{
|
||||
m_Instances.Add(Instantiate(category) as GameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
var fpsCounter = new Rect(new Vector2(0.9F * Screen.width, 0.1f * Screen.height), new Vector2(0.1F * Screen.width, 0.1f * Screen.height));
|
||||
float framerate = 1 / Time.deltaTime;
|
||||
fps = (1 * framerate + fpssamples * fps) / (1 + fpssamples);
|
||||
GUI.Label(fpsCounter, fps.ToString());
|
||||
fpssamples = Mathf.Min(1000, fpssamples + 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a9da7454dab41842ad0833069495d6c
|
||||
timeCreated: 1499716825
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fd0b473e331a1149aeb7ba3a764f984
|
||||
folderAsset: yes
|
||||
timeCreated: 1494560075
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88f6a47f25f3cdf43a488a86696898aa
|
||||
folderAsset: yes
|
||||
timeCreated: 1502400582
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,288 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
|
||||
public class BaseConditionsTests
|
||||
{
|
||||
[UnityTest]
|
||||
public IEnumerator AnimatePhysics_False_DoesntApplyVelocity([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.InstantiateCube(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
var rb = animation.gameObject.AddComponent<Rigidbody>();
|
||||
rb.useGravity = false;
|
||||
animation.gameObject.GetComponent<BoxCollider>().enabled = false;
|
||||
animation.animatePhysics = false;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
|
||||
yield return null;
|
||||
yield return null;
|
||||
Assert.AreEqual(0f, rb.velocity.x);
|
||||
Assert.AreEqual(0f, rb.velocity.z);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator CullingMode_AlwaysAnimate_Animates_InvisibleObject([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.InstantiateCube(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.cullingMode = AnimatorCullingMode.AlwaysAnimate;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.gameObject.GetComponent<MeshRenderer>().enabled = false;
|
||||
animation.Play("test");
|
||||
|
||||
yield return null;
|
||||
yield return null;
|
||||
Assert.AreNotEqual(Vector3.zero, animation.gameObject.transform.localPosition);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator CullingMode_CullCompletely_Doesnt_Animate_InvisibleObject([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.InstantiateCube(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.cullingMode = AnimatorCullingMode.CullCompletely;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.gameObject.GetComponent<MeshRenderer>().enabled = false;
|
||||
animation.Play("test");
|
||||
|
||||
yield return null;
|
||||
yield return null;
|
||||
Assert.AreEqual(Vector3.zero, animation.gameObject.transform.localPosition);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsPlaying_BeforePlay_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
Assert.AreEqual(false, animation.isPlaying);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsPlaying_AfterPlay_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
Assert.AreEqual(true, animation.isPlaying);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator IsPlaying_AfterStop_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
yield return null;
|
||||
animation.Stop();
|
||||
Assert.AreEqual(false, animation.isPlaying);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator IsPlaying_AfterClipDone_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance.wrapMode = WrapMode.Once;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
yield return new WaitForSeconds(2f);
|
||||
Assert.AreEqual(false, animation.isPlaying);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator IsPlaying_AfterCrossfadeDone_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance.wrapMode = WrapMode.Once;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.AddClip(clipInstance, "test2");
|
||||
animation.Play("test");
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
animation.CrossFade("test2", 1.5f);
|
||||
yield return new WaitForSeconds(2.0f);
|
||||
Assert.AreEqual(false, animation.isPlaying);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultClip_DoesntPlay_When_IsPlayingAutomatically_IsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
animation.clip = clipInstance;
|
||||
animation.playAutomatically = false;
|
||||
|
||||
Assert.AreEqual(false, animation.isPlaying);
|
||||
Assert.AreEqual(false, animation.IsPlaying(animation.clip.name));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultClip_Plays_When_IsPlayingAutomatically_IsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
animation.clip = clipInstance;
|
||||
animation.playAutomatically = true;
|
||||
|
||||
var newGO = Object.Instantiate<GameObject>(animation.gameObject);
|
||||
animation = newGO.GetComponent<IAnimation>();
|
||||
|
||||
Assert.AreEqual(true, animation.isPlaying);
|
||||
var defaultName = animation.usesLegacy ? animation.clip.name : "Default";
|
||||
Assert.AreEqual(true, animation.IsPlaying(defaultName));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PlayAutomatically_HasNoEffect_WhenThereIsNo_DefaultClip([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
animation.playAutomatically = true;
|
||||
|
||||
var newGO = Object.Instantiate<GameObject>(animation.gameObject);
|
||||
animation = newGO.GetComponent<IAnimation>();
|
||||
|
||||
Assert.AreEqual(false, animation.isPlaying);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PlayAutomatically_WithNo_DefaultClip_HasNoEffect_OnOtherClips([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
animation.playAutomatically = true;
|
||||
animation.AddClip(clipInstance, clipInstance.name);
|
||||
|
||||
var newGO = Object.Instantiate<GameObject>(animation.gameObject);
|
||||
animation = newGO.GetComponent<IAnimation>();
|
||||
|
||||
Assert.AreEqual(false, animation.isPlaying);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PlayAutomatically_With_DefaultClip_HasNoEffect_OnOtherClips([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
animation.clip = clipInstance;
|
||||
animation.playAutomatically = true;
|
||||
animation.AddClip(clipInstance, "OtherClip");
|
||||
|
||||
Assert.AreEqual(false, animation.IsPlaying("OtherClip"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PlayAutomatically_BeforeSet_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
Assert.AreEqual(true, animation.playAutomatically);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PlayAutomatically_AfterSet_True_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
animation.playAutomatically = true;
|
||||
Assert.AreEqual(true, animation.playAutomatically);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PlayAutomatically_AfterSet_False_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
animation.playAutomatically = false;
|
||||
Assert.AreEqual(false, animation.playAutomatically);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator WrapMode_Default_UsesClipSetting([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance.wrapMode = WrapMode.Loop;
|
||||
|
||||
animation.wrapMode = WrapMode.Default;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
|
||||
yield return new WaitForSeconds(1.2f);
|
||||
Assert.AreEqual(true, animation.isPlaying);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator WrapMode_OverridesClipsWithDefaultSetting([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance.wrapMode = WrapMode.Default;
|
||||
|
||||
animation.wrapMode = WrapMode.Loop;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
|
||||
yield return new WaitForSeconds(1.2f);
|
||||
Assert.AreEqual(true, animation.isPlaying);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator WrapMode_DoesntOverrideClipsSetting([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance.wrapMode = WrapMode.Once;
|
||||
|
||||
animation.wrapMode = WrapMode.Loop;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
|
||||
yield return new WaitForSeconds(1.2f);
|
||||
Assert.AreEqual(false, animation.isPlaying);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94d35051e65be294187c9630c79078d1
|
||||
timeCreated: 1494560140
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,202 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class ClipManagementTests
|
||||
{
|
||||
public class GetClipCount
|
||||
{
|
||||
[Test]
|
||||
public void GetClipCount_BeforeAdd_ReturnsZero([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
Assert.AreEqual(0, animation.GetClipCount(), "Component should have no clips connected at this point");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetClipCount_AfterAddOne_ReturnsOne([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
|
||||
Assert.AreEqual(1, animation.GetClipCount(), "Component should have 1 clip connected after add");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetClipCount_AfterRemoveSingleClip_ReturnsZero([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.RemoveClip("test");
|
||||
|
||||
Assert.AreEqual(0, animation.GetClipCount(), "Component should have no clips after remove");
|
||||
}
|
||||
}
|
||||
|
||||
public class AddClip
|
||||
{
|
||||
[Test]
|
||||
public void AddClip_WithNullClip_Throws_NullReferenceException([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
Assert.Throws<System.NullReferenceException> (() => { animation.AddClip(null, "test"); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddClip_TwiceWithSameName_GetClipCount_ReturnsOne([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
LogAssert.ignoreFailingMessages = true; //The error message here is irrelevant
|
||||
animation.AddClip(clipInstance, "test");
|
||||
LogAssert.ignoreFailingMessages = false;
|
||||
|
||||
Assert.AreEqual(1, animation.GetClipCount(), "Component should have no clips after remove");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddClip_TwiceDifferentName_GetClipCount_ReturnsTwo([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.AddClip(clipInstance, "test2");
|
||||
Assert.AreEqual(2, animation.GetClipCount(), "Component should have no clips after remove");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddClip_WithSameName_AsClip_DoenstCreateNewClip([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, clipInstance.name);
|
||||
IAnimationState state = animation.GetState(clipInstance.name);
|
||||
Assert.AreEqual(clipInstance, state.clip, "Component should have no clips after remove");
|
||||
}
|
||||
}
|
||||
|
||||
public class RemoveClip_ByAnimationClip
|
||||
{
|
||||
[Test]
|
||||
public void RemoveClip_AnimationClip_WithNullClip_Throws_NullReferenceException([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
AnimationClip clip = null;
|
||||
Assert.Throws<System.NullReferenceException> (() => { animation.RemoveClip(clip); });
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Description("AddClip always duplicates clips in the Animation Component, making it very hard to remove clips")]
|
||||
public void RemoveClip_AnimationClip_RemovesClip([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, clipInstance.name);
|
||||
animation.RemoveClip(clipInstance);
|
||||
Assert.AreEqual(0, animation.GetClipCount(), "Component should have no clips after remove");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveClip_AnimationClip_DoesntRemoveUnrelatedClips([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clip2 = Resources.Load<AnimationClip>("LinearY");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
var clipInstance2 = Object.Instantiate<AnimationClip>(clip2);
|
||||
clipInstance2.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, clipInstance.name);
|
||||
animation.AddClip(clipInstance2, clipInstance2.name);
|
||||
animation.RemoveClip(clipInstance);
|
||||
Assert.AreEqual(1, animation.GetClipCount(), "Component should still have 1 connected clip after remove");
|
||||
Assert.NotNull(animation.GetState(clipInstance2.name));
|
||||
}
|
||||
}
|
||||
|
||||
public class RemoveClip_ByName
|
||||
{
|
||||
[Test]
|
||||
public void RemoveClip_ByName_WithEmptyName_Works([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "");
|
||||
animation.RemoveClip("");
|
||||
Assert.AreEqual(0, animation.GetClipCount(), "Component should still have 1 connected clip after remove");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveClip_ByName_DoesntRemoveOtherClips([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
var legacyClip2 = Object.Instantiate<AnimationClip>(clipInstance);
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.AddClip(legacyClip2, "test2");
|
||||
animation.RemoveClip("test");
|
||||
Assert.AreEqual(1, animation.GetClipCount(), "Component should still have 1 connected clip after remove");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveClip_ByName_RemovesClip([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.RemoveClip("test");
|
||||
Assert.AreEqual(0, animation.GetClipCount(), "Component should still have 1 connected clip after remove");
|
||||
}
|
||||
}
|
||||
|
||||
public class RemoveClip
|
||||
{
|
||||
[Test]
|
||||
public void RemoveClip_Invalidates_ExistingState([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, clipInstance.name);
|
||||
IAnimationState state = animation.GetState(clipInstance.name);
|
||||
animation.RemoveClip(clipInstance);
|
||||
Assert.IsFalse(state.isValid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b00cae6d5f62bb41a1a48f5c48069fe
|
||||
timeCreated: 1494560140
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
class ComparativeTestFixture
|
||||
{
|
||||
private static System.Type[] Sources()
|
||||
{
|
||||
return new Type [] { typeof(AnimationProxy), typeof(SimpleAnimationProxy) };
|
||||
}
|
||||
|
||||
public static IAnimation Instantiate(System.Type type)
|
||||
{
|
||||
var go = new GameObject();
|
||||
var component = go.AddComponent(type);
|
||||
return component as IAnimation;
|
||||
}
|
||||
|
||||
public static IAnimation InstantiateCube(System.Type type)
|
||||
{
|
||||
var go = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
var component = go.AddComponent(type);
|
||||
return component as IAnimation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98de67babe968c640aa589d5b3a449c2
|
||||
timeCreated: 1496940236
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,189 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class DifferencesTests
|
||||
{
|
||||
[Test]
|
||||
[Ignore("The Animation Component creates a new internal clip instance when a state has a different name than the name of the clip. This was deemed an undesirable behavior")]
|
||||
public void AddClip_WithNewName_CreatesNewClip([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "NewName");
|
||||
IAnimationState state = animation.GetState("NewName");
|
||||
Assert.AreNotEqual(clipInstance, state.clip, "AddClip should have created a new clip instance");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("This is where the new component differs. Animation won't let you remove multiple states with the same clip, because it's not possible to have the same clip twice")]
|
||||
public void RemoveClip_AnimationClip_RemovesAllInstances([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.AddClip(clipInstance, "test2");
|
||||
animation.RemoveClip(clipInstance);
|
||||
Assert.AreEqual(0, animation.GetClipCount(), "Component should have no clips after remove");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
[Ignore("Time does not advance on the frame on which Rewind is called on SimpleAnimation")]
|
||||
public IEnumerator Rewind_PlaysFrameZero([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
animation.AddClip(clipInstanceX, "ValidName");
|
||||
animation.Play("ValidName");
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.x);
|
||||
animation.Rewind("ValidName");
|
||||
yield return null;
|
||||
Assert.AreEqual(0f, animation.gameObject.transform.localPosition.x);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Check were added to SimpleAnimation to prevent using invalid names")]
|
||||
public void Rewind_WithInvalidName_FailsOnCall([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
LogAssert.Expect(LogType.Error, new Regex(""));
|
||||
animation.Rewind("InvalidName");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Check were added to SimpleAnimation to prevent using invalid names")]
|
||||
public void Stop_WithInvalidName_FailsOnCall([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
LogAssert.Expect(LogType.Error, new Regex(""));
|
||||
animation.Stop("InvalidName");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("The Animation Component accepts null as a valid name")]
|
||||
public void State_Name_NullString_Throws_ArgumentNullException([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
Assert.Throws<System.ArgumentNullException>(() => { state.name = null; });
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
[Ignore("Setting time guarantees you that the next automatic evaluation will use the time you supplied with Playables, whereas Animation Component will update the frame time")]
|
||||
public IEnumerator State_Time_SetTime_PreventsUpdatingTimeAutomatically([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
float time = Time.time;
|
||||
state.time = 0.1f; //empty run for the Animation component, probably a side effect of reenabling the component
|
||||
yield return null;
|
||||
|
||||
state.time = 0.1f;
|
||||
yield return null;
|
||||
|
||||
Assert.AreEqual(0.1f, state.time);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
[Ignore("The Animation Component doesn't advance on the first frame")]
|
||||
public IEnumerator State_Time_IsSynchronizedWith_GameTime([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
float previousTime = Time.time;
|
||||
yield return null;
|
||||
yield return null;
|
||||
yield return null;
|
||||
float elapsedTime = Time.time - previousTime;
|
||||
Assert.AreEqual(elapsedTime, state.time, 0.001f, "State time should be equal to elapsed time");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
[Ignore("In the Animation Component, RemoveClip doesn't remove queued instances of the removed clip, whereas Stop stops both the queued instances and the playing instances. This inconsistency was deemed undesirable")]
|
||||
public IEnumerator Queue_RemoveClip_StopsQueuedClips([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "PlayAndQueue");
|
||||
animation.Play("PlayAndQueue");
|
||||
animation.PlayQueued("PlayAndQueue", QueueMode.CompleteOthers);
|
||||
yield return null;
|
||||
animation.RemoveClip("PlayAndQueue");
|
||||
Assert.IsFalse(animation.isPlaying);
|
||||
yield return null;
|
||||
Assert.IsFalse(animation.isPlaying);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
[Ignore("States that play backwards should still be Queue-compatible, which is not the case in the Animation Component")]
|
||||
public IEnumerator NegativeSpeed_Does_Trigger_Crossfade([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "PlayBackwards");
|
||||
animation.AddClip(clipInstance, "Crossfade");
|
||||
IAnimationState state = animation.GetState("PlayBackwards");
|
||||
state.enabled = true;
|
||||
state.time = 0.5f;
|
||||
state.speed = -1f;
|
||||
animation.PlayQueued("Crossfade", QueueMode.CompleteOthers);
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
||||
Assert.IsTrue(state.enabled);
|
||||
Assert.IsTrue(animation.IsPlaying("Crossfade"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
[Ignore("The Animation Component doesn't apply velocities to rigidbodies with AnimatePhysics on")]
|
||||
public IEnumerator AnimatePhysics_True_AppliesVelocity([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.InstantiateCube(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
var rb = animation.gameObject.AddComponent<Rigidbody>();
|
||||
rb.useGravity = false;
|
||||
animation.animatePhysics = true;
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
|
||||
yield return null;
|
||||
yield return new WaitForSeconds(0.3f);
|
||||
Assert.AreNotEqual(rb.velocity, Vector3.zero);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b19f00406c66144ab1f66fe9c78fabb
|
||||
timeCreated: 1499370755
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class MiscTests
|
||||
{
|
||||
[UnityTest]
|
||||
public IEnumerator StateSpeed_Affects_WhenCrossfadeHappens([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "PlaySlowly");
|
||||
animation.AddClip(clipInstance, "Queued");
|
||||
IAnimationState state = animation.GetState("PlaySlowly");
|
||||
state.enabled = true;
|
||||
state.speed = 0.1f;
|
||||
animation.PlayQueued("Queued", QueueMode.CompleteOthers);
|
||||
|
||||
//Wait for the original length of PlaySlowly
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
Assert.IsFalse(animation.IsPlaying("Queued"), "Clip 'Queued' should not be playing yet. Speed is probably applied wrong.");
|
||||
state.speed = 1000.0f;
|
||||
yield return null;
|
||||
yield return null;
|
||||
Assert.IsTrue(animation.IsPlaying("Queued"), "Clip 'PlaySlowly' should now be done, and clip 'Queued' should have started playing.");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PlayQueue_WithLoopedAnimation_Prevents_StateAccess_OfOriginalState_FromWorking_Correctly([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
var loopedClipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
loopedClipInstance.legacy = animation.usesLegacy;
|
||||
loopedClipInstance.wrapMode = WrapMode.Loop;
|
||||
|
||||
animation.AddClip(clipInstance, "FirstClip");
|
||||
animation.AddClip(loopedClipInstance, "LoopedClip");
|
||||
animation.Play("FirstClip");
|
||||
animation.PlayQueued("LoopedClip", QueueMode.CompleteOthers);
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
Assert.IsTrue(animation.IsPlaying("LoopedClip"), "Clip 'LoopedClip' should be playing");
|
||||
IAnimationState state = animation.GetState("LoopedClip");
|
||||
|
||||
Assert.IsFalse(state.enabled, "We should be playing a copy of LoopedClip, not the LoopedClip State");
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
state = animation.GetState("LoopedClip");
|
||||
Assert.IsFalse(state.enabled, "We should still be playing a copy of LoopedClip, not the LoopedClip State");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6e209b2d0c68024ebd0ce0df3d50480
|
||||
timeCreated: 1499452822
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,806 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class PlaybackTests
|
||||
{
|
||||
public class Play
|
||||
{
|
||||
[Test]
|
||||
public void Play_WithInvalidName_FailsOnCall([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
LogAssert.Expect(LogType.Error, new Regex(""));
|
||||
animation.Play("WrongState");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Play_ValidName_IsPlaying_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "RightName");
|
||||
animation.Play("RightName");
|
||||
Assert.IsTrue(animation.isPlaying, "The clip RightName should be playing");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Play_ValidName_MovesObject([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
animation.Play("ValidName");
|
||||
|
||||
//TODO: replace by Seek(time)
|
||||
yield return null;
|
||||
yield return null;
|
||||
yield return null;
|
||||
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.x, "LocalPosition.x should have been moved by the clip");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Play_OtherClip_IsPlaying_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
var clipInstance2 = Object.Instantiate<AnimationClip>(clipInstance);
|
||||
clipInstance2.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ClipToPlayOver");
|
||||
animation.AddClip(clipInstance2, "ClipThatPlaysOver");
|
||||
animation.Play("ClipToPlayOver");
|
||||
yield return null;
|
||||
animation.Play("ClipThatPlaysOver");
|
||||
|
||||
Assert.IsFalse(animation.IsPlaying("ClipToPlayOver"), "ClipToPlayOver should be stopped by playing ClipThatPlaysOver");
|
||||
Assert.IsTrue(animation.IsPlaying("ClipThatPlaysOver"), "ClipThatPlaysOver should now be the only playing clip");
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Play_SameClip_StateTime_DoesntChange([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
|
||||
yield return null;
|
||||
|
||||
float time = animation.GetState("test").time;
|
||||
animation.Play("test");
|
||||
Assert.AreEqual(time, animation.GetState("test").time);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Play_SameClip_Done_StateTime_Resets([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "test");
|
||||
animation.Play("test");
|
||||
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
|
||||
float time = animation.GetState("test").time;
|
||||
animation.Play("test");
|
||||
Assert.AreEqual(0f, animation.GetState("test").time);
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayQueue_CompleteOthers
|
||||
{
|
||||
[Test]
|
||||
public void PlayQueue_WithInvalidName_FailsOnCall([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
LogAssert.Expect(LogType.Error, new Regex(""));
|
||||
animation.PlayQueued("InvalidName", QueueMode.CompleteOthers);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PlayQueue_WithNoClipPlaying_IsStatePlaying_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlayQueue");
|
||||
animation.PlayQueued("ToPlayQueue", QueueMode.CompleteOthers);
|
||||
|
||||
yield return null;
|
||||
Assert.IsTrue(animation.IsPlaying("ToPlayQueue"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PlayQueue_WithClipPlaying_IsStatePlaying_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
animation.AddClip(clipInstance, "ToPlayQueue");
|
||||
animation.Play("ToPlay");
|
||||
animation.PlayQueued("ToPlayQueue", QueueMode.CompleteOthers);
|
||||
|
||||
Assert.IsFalse(animation.IsPlaying("ToPlayQueue"));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PlayQueue_WithClipPlaying_IsStatePlaying_AfterOriginalClipDone_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
animation.AddClip(clipInstance, "ToPlayQueue");
|
||||
animation.Play("ToPlay");
|
||||
animation.PlayQueued("ToPlayQueue", QueueMode.CompleteOthers);
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToPlayQueue"));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator PlayQueue_Queueing_SameClip_AfterFirstClipIsDone_IsPlaying_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlayAndPlayQueue");
|
||||
animation.Play("ToPlayAndPlayQueue");
|
||||
animation.PlayQueued("ToPlayAndPlayQueue", QueueMode.CompleteOthers);
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToPlayAndPlayQueue"));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayQueue_PlayNow
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class Crossfade
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void Crossfade_WithInvalidName_FailsOnCall([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
LogAssert.Expect(LogType.Error, new Regex(""));
|
||||
animation.CrossFade("InvalidName", 0);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crossfade_WithValidName_IsPlaying_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToCrossfade");
|
||||
animation.CrossFade("ToCrossfade", 0f);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToCrossfade"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Crossfade_WithValidName_MovesObject([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToCrossfade");
|
||||
animation.CrossFade("ToCrossfade", 0f);
|
||||
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.x);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Crossfade_LengthZero_StopsOtherClips([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
animation.AddClip(clipInstance, "ToCrossfade");
|
||||
animation.CrossFade("ToPlay", 0f);
|
||||
animation.CrossFade("ToCrossfade", 0.0f);
|
||||
|
||||
Assert.IsFalse(animation.IsPlaying("ToPlay"));
|
||||
}
|
||||
[Test]
|
||||
public void Crossfade_DoesntStopOtherClips([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
animation.AddClip(clipInstance, "ToCrossfade");
|
||||
animation.CrossFade("ToPlay", 0f);
|
||||
animation.CrossFade("ToCrossfade", 0.2f);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToPlay"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator CrossfadedOut_Clips_AreStopped([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
animation.AddClip(clipInstance, "ToCrossfade");
|
||||
animation.Play("ToPlay");
|
||||
animation.CrossFade("ToCrossfade", 0.1f);
|
||||
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
Assert.IsFalse(animation.IsPlaying("ToPlay"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator CrossfadedOut_Clips_AreTimeReset([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
animation.AddClip(clipInstance, "ToCrossfade");
|
||||
animation.Play("ToPlay");
|
||||
animation.CrossFade("ToCrossfade", 0.1f);
|
||||
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
Assert.AreEqual(0.0f, animation.GetState("ToPlay").normalizedTime);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Crossfade_MultipleTimes_DoesntReset_Crossfade_Duration([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clip2 = Resources.Load<AnimationClip>("LinearY");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
var clipInstance2 = Object.Instantiate<AnimationClip>(clip2);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance2.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
animation.AddClip(clipInstance2, "ToCrossfade");
|
||||
animation.Play("ToPlay");
|
||||
animation.CrossFade("ToCrossfade", 0.2f);
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
animation.CrossFade("ToCrossfade", 0.2f);
|
||||
yield return new WaitForSeconds(0.11f);
|
||||
Assert.AreEqual(0.0f, animation.GetState("ToPlay").weight);
|
||||
Assert.AreEqual(1.0f, animation.GetState("ToCrossfade").weight);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
[Ignore("Wrong Assumption; clips don't get kept alive by crossfade")]
|
||||
public IEnumerator Crossfade_FromFinishingClip_KeepsClipAlive_UntilCrossfadeDone([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipY = Resources.Load<AnimationClip>("LinearY");
|
||||
var xClip = Object.Instantiate<AnimationClip>(clipX);
|
||||
var yClip = Object.Instantiate<AnimationClip>(clipY);
|
||||
xClip.legacy = animation.usesLegacy;
|
||||
yClip.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(xClip, "ToPlay");
|
||||
animation.AddClip(yClip, "ToCrossfade");
|
||||
animation.Play("ToPlay");
|
||||
|
||||
yield return new WaitForSeconds(0.9f);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToPlay"));
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.y);
|
||||
animation.CrossFade("ToCrossfade", 0.5f);
|
||||
yield return new WaitForSeconds(0.3f);
|
||||
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.y);
|
||||
Assert.IsTrue(animation.IsPlaying("ToCrossfade"));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
[Ignore("Wrong Assumption; clips don't get kept alive by crossfade")]
|
||||
public IEnumerator Crossfade_LongerThanClip_KeepsClipAlive_UntilCrossfadeDone([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipY = Resources.Load<AnimationClip>("LinearY");
|
||||
var xClip = Object.Instantiate<AnimationClip>(clipX);
|
||||
var yClip = Object.Instantiate<AnimationClip>(clipY);
|
||||
xClip.legacy = animation.usesLegacy;
|
||||
yClip.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(yClip, "ToPlay");
|
||||
animation.AddClip(xClip, "ToCrossfade");
|
||||
animation.Play("ToPlay");
|
||||
|
||||
yield return new WaitForSeconds(0.9f);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToPlay"));
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.y);
|
||||
animation.CrossFade("ToCrossfade", 1.2f);
|
||||
yield return new WaitForSeconds(1.5f);
|
||||
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.y);
|
||||
Assert.IsTrue(animation.IsPlaying("ToCrossfade"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CrossfadeQueue
|
||||
{
|
||||
[Test]
|
||||
public void CrossfadeQueue_WithNoClipAttached_FailsOnCall([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
LogAssert.Expect(LogType.Error, new Regex(""));
|
||||
animation.CrossFadeQueued("UnknownState", 0f, QueueMode.CompleteOthers);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator CrossfadeQueue_WithInvalidName_FailsOnCall([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
LogAssert.Expect(LogType.Error, new Regex(""));
|
||||
animation.CrossFadeQueued("invalidName", 0f, QueueMode.CompleteOthers);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator CrossfadeQueue_WithNoClipPlaying_IsStatePlaying_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToPlay");
|
||||
animation.CrossFadeQueued("ToPlay", 0f, QueueMode.CompleteOthers);
|
||||
|
||||
yield return null;
|
||||
Assert.IsTrue(animation.IsPlaying("ToPlay"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator CrossfadeQueue_WithClipPlaying_IsStatePlaying_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipY = Resources.Load<AnimationClip>("LinearY");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
var clipInstanceY = Object.Instantiate<AnimationClip>(clipY);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
clipInstanceY.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceY, "ToPlay");
|
||||
animation.AddClip(clipInstanceX, "ToCrossfade");
|
||||
animation.Play("ToPlay");
|
||||
animation.CrossFadeQueued("ToCrossfade", 0.5f, QueueMode.CompleteOthers);
|
||||
yield return null;
|
||||
|
||||
Assert.IsFalse(animation.IsPlaying("ToCrossfade"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator CrossfadeQueue_WithClipPlaying_IsStatePlaying_AfterOriginalClipDone_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipY = Resources.Load<AnimationClip>("LinearY");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
var clipInstanceY = Object.Instantiate<AnimationClip>(clipY);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
clipInstanceY.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceY, "ToPlay");
|
||||
animation.AddClip(clipInstanceX, "ToCrossfade");
|
||||
animation.Play("ToPlay");
|
||||
animation.CrossFadeQueued("ToCrossfade", 0.0f, QueueMode.CompleteOthers);
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToCrossfade"));
|
||||
}
|
||||
}
|
||||
|
||||
public class Stop
|
||||
{
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Stop_ValidName_NotPlaying_IsPlaying_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
animation.AddClip(clipInstanceX, "ValidName");
|
||||
|
||||
yield return null;
|
||||
|
||||
animation.Stop("ValidName");
|
||||
Assert.IsFalse(animation.IsPlaying("ValidName"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Stop_ValidName_Playing_IsPlaying_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
animation.AddClip(clipInstanceX, "ValidName");
|
||||
animation.Play("ValidName");
|
||||
|
||||
yield return null;
|
||||
|
||||
animation.Stop("ValidName");
|
||||
Assert.IsFalse(animation.IsPlaying("ValidName"));
|
||||
}
|
||||
[UnityTest]
|
||||
public IEnumerator Stop_ValidName_DoesntMoveObject([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
animation.AddClip(clipInstanceX, "ValidName");
|
||||
animation.Play("ValidName");
|
||||
|
||||
yield return null;
|
||||
|
||||
Vector3 localPos = animation.gameObject.transform.localPosition;
|
||||
animation.Stop("ValidName");
|
||||
Assert.AreEqual(localPos, animation.gameObject.transform.localPosition);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Stop_WithName_OtherClip_IsPlaying_DoesntChange([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipY = Resources.Load<AnimationClip>("LinearY");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
var clipInstanceY = Object.Instantiate<AnimationClip>(clipY);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
clipInstanceY.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceY, "ClipToStop");
|
||||
animation.AddClip(clipInstanceX, "OtherClip");
|
||||
var stateToStop = animation.GetState("ClipToStop");
|
||||
var otherState = animation.GetState("OtherClip");
|
||||
|
||||
stateToStop.weight = 1f;
|
||||
stateToStop.enabled = true;
|
||||
otherState.weight = 1f;
|
||||
otherState.enabled = true;
|
||||
|
||||
yield return null;
|
||||
|
||||
animation.Stop("ClipToStop");
|
||||
Assert.IsFalse(animation.IsPlaying("ClipToStop"));
|
||||
Assert.IsTrue(animation.IsPlaying("OtherClip"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Stop_WithoutName_IsPlaying_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipY = Resources.Load<AnimationClip>("LinearY");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
var clipInstanceY = Object.Instantiate<AnimationClip>(clipY);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
clipInstanceY.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceY, "clip1");
|
||||
animation.AddClip(clipInstanceX, "clip2");
|
||||
|
||||
animation.GetState("clip1").enabled = true;
|
||||
animation.GetState("clip1").weight = 0.5f;
|
||||
|
||||
animation.GetState("clip2").enabled = true;
|
||||
animation.GetState("clip2").weight = 0.5f;
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("clip1"));
|
||||
Assert.IsTrue(animation.IsPlaying("clip2"));
|
||||
yield return null;
|
||||
|
||||
animation.Stop();
|
||||
Assert.IsFalse(animation.IsPlaying("clip1"));
|
||||
Assert.IsFalse(animation.IsPlaying("clip2"));
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Stop_Playing_StoppedState_DoesntFire_AnyEvents([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var eventReceiver = animation.gameObject.AddComponent<SimpleAnimationTests.ReceivesEvent>();
|
||||
var clip = Resources.Load<AnimationClip>("FiresEvent");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "FiresEvent");
|
||||
animation.Play("FiresEvent");
|
||||
yield return new WaitForSeconds(0.6f);
|
||||
|
||||
Assert.AreEqual(1, eventReceiver.eventCount, "Event at 0.5 should have fired");
|
||||
animation.Stop("FiresEvent");
|
||||
animation.Play("FiresEvent");
|
||||
Assert.AreEqual(0.0f, animation.GetState("FiresEvent").time, "Time should have reset to 0");
|
||||
Assert.AreEqual(1, eventReceiver.eventCount, "No new event should have fired");
|
||||
yield return null;
|
||||
Assert.AreEqual(1, eventReceiver.eventCount, "No new event should have fired after update");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class Rewind
|
||||
{
|
||||
[Test]
|
||||
public void Rewind_ValidName_NotPlaying_StateTime_IsZero([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
animation.AddClip(clipInstanceX, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.time = 0.5f;
|
||||
animation.Rewind("ValidName");
|
||||
Assert.AreEqual(0f, state.time);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Rewind_ValidName_Playing_StateTime_IsZero([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
animation.AddClip(clipInstanceX, "ValidName");
|
||||
animation.Play("ValidName");
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
|
||||
animation.Rewind("ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
Assert.AreEqual(0f, state.time);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Rewind_WithName_OtherClip_Time_DoesntChange([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToRewind");
|
||||
animation.AddClip(clipInstance, "ToLeaveAlone");
|
||||
IAnimationState toRewind = animation.GetState("ToRewind");
|
||||
toRewind.time = 0.5f;
|
||||
IAnimationState toLeaveAlone = animation.GetState("ToLeaveAlone");
|
||||
toLeaveAlone.time = 0.5f;
|
||||
|
||||
animation.Rewind("ToRewind");
|
||||
Assert.AreNotEqual(0f, toLeaveAlone.time);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Rewind_WithoutName_AllStateTimes_AreZero([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ToRewind");
|
||||
animation.AddClip(clipInstance, "ToRewindToo");
|
||||
IAnimationState toRewind = animation.GetState("ToRewind");
|
||||
toRewind.time = 0.5f;
|
||||
IAnimationState toRewindToo = animation.GetState("ToRewindToo");
|
||||
toRewindToo.time = 0.5f;
|
||||
|
||||
animation.Rewind();
|
||||
Assert.AreEqual(0f, toRewind.time);
|
||||
Assert.AreEqual(0f, toRewindToo.time);
|
||||
}
|
||||
}
|
||||
|
||||
public class Sample
|
||||
{
|
||||
[Test]
|
||||
public void Sample_DoesntChange_StateTime([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceX, "clip1");
|
||||
|
||||
animation.GetState("clip1").enabled = true;
|
||||
animation.GetState("clip1").weight = 1f;
|
||||
animation.GetState("clip1").time = 0.5f;
|
||||
animation.Sample();
|
||||
|
||||
Assert.AreEqual(0.5f, animation.gameObject.transform.localPosition.x);
|
||||
Assert.IsTrue(Mathf.Approximately(0.5f, animation.GetState("clip1").time));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sample_EvaluatesAt_StateTime([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceX, "ToSample");
|
||||
IAnimationState state = animation.GetState("ToSample");
|
||||
|
||||
state.enabled = true;
|
||||
state.weight = 1f;
|
||||
state.time = 0.5f;
|
||||
animation.Sample();
|
||||
|
||||
Assert.AreEqual(0.5f, animation.gameObject.transform.localPosition.x);
|
||||
}
|
||||
}
|
||||
|
||||
public class Blend
|
||||
{
|
||||
[Test]
|
||||
public void Blend_AfterBlend_Instant_State_IsPlaying([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceX, "ToBlend");
|
||||
animation.Blend("ToBlend", 1, 0);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToBlend"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Blend_AfterBlend_NonInstant_State_IsPlaying([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceX, "ToBlend");
|
||||
animation.Blend("ToBlend", 1, 0.5f);
|
||||
|
||||
Assert.IsTrue(animation.IsPlaying("ToBlend"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Blend_DoesntChange_OtherState_Weight([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance1 = Object.Instantiate<AnimationClip>(clipX);
|
||||
var clipInstance2 = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstance1.legacy = animation.usesLegacy;
|
||||
clipInstance2.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance1, "ToBlend");
|
||||
animation.AddClip(clipInstance2, "ToLeaveAlone");
|
||||
animation.Play("ToLeaveAlone");
|
||||
animation.Blend("ToBlend", 1f, 0f);
|
||||
|
||||
Assert.AreEqual(1f, animation.GetState("ToLeaveAlone").weight);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Blend_Instant_WithWeightZero_State_DoesntStop_State([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstanceX, "ToBlend");
|
||||
animation.Blend("ToBlend", 0, 0);
|
||||
yield return null;
|
||||
Assert.IsTrue(animation.IsPlaying("ToBlend"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class PlayQueued
|
||||
{
|
||||
[UnityTest]
|
||||
public IEnumerator PlayQueued_Only_Plays_QueuedAnimations_Once([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clipX = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstanceX = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceX.legacy = animation.usesLegacy;
|
||||
var clipInstanceXOnce = Object.Instantiate<AnimationClip>(clipX);
|
||||
clipInstanceXOnce.legacy = animation.usesLegacy;
|
||||
clipInstanceXOnce.wrapMode = WrapMode.Once;
|
||||
|
||||
animation.AddClip(clipInstanceX, "A");
|
||||
animation.AddClip(clipInstanceX, "B");
|
||||
animation.AddClip(clipInstanceX, "C");
|
||||
|
||||
animation.Play("A");
|
||||
animation.PlayQueued("B", QueueMode.CompleteOthers);
|
||||
animation.PlayQueued("C", QueueMode.CompleteOthers);
|
||||
yield return new WaitForSeconds(2.8f);
|
||||
Assert.IsTrue(animation.IsPlaying("C"));
|
||||
yield return new WaitForSeconds(0.3f);
|
||||
Assert.IsFalse(animation.isPlaying);
|
||||
}
|
||||
//TODO: Crossfade and Play clears queued animations
|
||||
//TODO: Stop clears queued animations
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fd08db4a0ee3ce47b1e4f8a0913f89d
|
||||
timeCreated: 1494560140
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,61 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class QueueTests
|
||||
{
|
||||
[UnityTest]
|
||||
public IEnumerator Queue_Stop_Clip_StopsQueuedClip([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "PlayAndQueue");
|
||||
animation.Play("PlayAndQueue");
|
||||
animation.PlayQueued("PlayAndQueue", QueueMode.CompleteOthers);
|
||||
yield return null;
|
||||
animation.Stop("PlayAndQueue");
|
||||
Assert.IsFalse(animation.isPlaying);
|
||||
yield return null;
|
||||
//Queued animation would have started if it was going to.
|
||||
Assert.IsFalse(animation.isPlaying);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Enabled_DoesntCover_QueuedState([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "PlayAndQueue");
|
||||
animation.Play("PlayAndQueue");
|
||||
animation.PlayQueued("PlayAndQueue", QueueMode.CompleteOthers);
|
||||
IAnimationState state = animation.GetState("PlayAndQueue");
|
||||
Assert.IsTrue(state.enabled);
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
Assert.IsFalse(state.enabled);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Queue_Looped_Clips_Block_QueuedAnimations([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance.wrapMode = WrapMode.Loop;
|
||||
|
||||
animation.AddClip(clipInstance, "Play");
|
||||
animation.AddClip(clipInstance, "Queued");
|
||||
animation.Play("Play");
|
||||
animation.PlayQueued("Queued", QueueMode.CompleteOthers);
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
Assert.IsFalse(animation.IsPlaying("Queued"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92ce3265af6ad694c9d214d1b4fd6adc
|
||||
timeCreated: 1499439871
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,693 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
|
||||
public class StateAccessTests
|
||||
{
|
||||
public class BaseTests
|
||||
{
|
||||
[Test]
|
||||
public void GetState_WithNoState_ReturnsNull([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
|
||||
IAnimationState state = animation.GetState("InvalidName");
|
||||
Assert.AreEqual(null, state);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetState_WithState_ReturnsState([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
Assert.AreNotEqual(null, state);
|
||||
Assert.AreEqual("ValidName", state.name);
|
||||
}
|
||||
}
|
||||
|
||||
public class TimeTests
|
||||
{
|
||||
[Test]
|
||||
public void State_Time_Equals_Zero_BeforePlay([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
Assert.AreEqual(0f, state.time);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Time_Equals_Zero_AfterPlay([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
Assert.AreEqual(0f, state.time);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Time_Affects_ClipPlayback([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
state.weight = 1f;
|
||||
state.time = 0.5f;
|
||||
animation.Sample();
|
||||
Assert.AreEqual(animation.gameObject.transform.localPosition.x, state.time, "Sampling should have updated the position of the object at time 0.5");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Time_ChangesWith_GameTime([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
float previousTime = Time.time;
|
||||
yield return null;
|
||||
yield return null; //Since the Animation Component doesn't update the time on the first frame, we must wait two frames to see an effect
|
||||
float elapsedTime = Time.time - previousTime;
|
||||
Assert.AreNotEqual(elapsedTime, state.time, "State time should have changed");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Time_SetPast_ClipEnd_StopsState_AfterOneFrame([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
state.time = 2.0f;
|
||||
yield return null;
|
||||
Assert.IsFalse(state.enabled, "State should be disabled");
|
||||
Assert.IsFalse(animation.IsPlaying(state.name), "State should be disabled");
|
||||
Assert.IsFalse(animation.isPlaying, "State should be disabled");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Time_SetPast_ClipEnd_ThenBack_DoesntStopState([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
state.time = 2.0f;
|
||||
state.time = 0.2f;
|
||||
yield return null;
|
||||
Assert.IsTrue(state.enabled, "State should be enabled");
|
||||
Assert.IsTrue(animation.IsPlaying(state.name), "State should be playing");
|
||||
Assert.IsTrue(animation.isPlaying, "Component should be playing");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Time_SetPast_ClipEnd_Doesnt_Immediately_StopState([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
state.time = 2.0f;
|
||||
Assert.IsTrue(state.enabled, "State should be enabled");
|
||||
Assert.IsTrue(animation.IsPlaying(state.name), "State should be playing");
|
||||
Assert.IsTrue(animation.isPlaying, "Component should be playing");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Time_SetTime_DoesntStartState([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
state.time = 2.0f;
|
||||
state.time = 0.2f;
|
||||
yield return null;
|
||||
Assert.IsTrue(state.enabled, "State should be disabled");
|
||||
Assert.IsTrue(animation.IsPlaying(state.name), "State should be disabled");
|
||||
Assert.IsTrue(animation.isPlaying, "State should be disabled");
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Time_SetTime_DoesntPlayEvents([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("FiresEvent");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
var eventReceiver = animation.gameObject.AddComponent<SimpleAnimationTests.ReceivesEvent>();
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
state.time = 0.1f;
|
||||
yield return null;
|
||||
Assert.AreEqual(0, eventReceiver.eventCount, "Event should not have been received");
|
||||
state.time = 0.6f;
|
||||
yield return null;
|
||||
Assert.AreEqual(0, eventReceiver.eventCount, "Event should have been received after setting the time on the state");
|
||||
}
|
||||
}
|
||||
|
||||
public class NormalizedTime
|
||||
{
|
||||
[Test]
|
||||
public void State_NormalizedTime_AffectsTime([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
//Create event to extend clip
|
||||
var evt = new AnimationEvent();
|
||||
evt.time = 2.0f;
|
||||
clipInstance.AddEvent(evt);
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.normalizedTime = 0.5f;
|
||||
Assert.AreEqual(state.normalizedTime*state.length, state.time);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Time_AffectsNormalizedTime([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
//Create event to extend clip
|
||||
var evt = new AnimationEvent();
|
||||
evt.time = 2.0f;
|
||||
clipInstance.AddEvent(evt);
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.time = 0.5f;
|
||||
Assert.AreEqual(state.time / state.length, state.normalizedTime);
|
||||
}
|
||||
}
|
||||
|
||||
public class Enabled
|
||||
{
|
||||
[Test]
|
||||
public void State_Enabled_InitialValue_False([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
Assert.IsFalse(state.enabled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Enabled_SetTrue_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
Assert.IsTrue(state.enabled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Enabled_AfterPlay_ReturnsTrue([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
Assert.IsTrue(state.enabled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Enabled_AfterStop_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
animation.Stop(state.name);
|
||||
Assert.IsFalse(state.enabled);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Enabled_AfterStateEnd_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
yield return new WaitForSeconds(1.1f);
|
||||
|
||||
Assert.IsFalse(state.enabled);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Enabled_AfterSetTime_ToStateEnd_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
state.time = 2f;
|
||||
yield return null;
|
||||
Assert.IsFalse(state.enabled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Enabled_False_IsPlaying_ReturnsFalse([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
animation.Play(state.name);
|
||||
state.enabled = false;
|
||||
Assert.IsFalse(animation.isPlaying);
|
||||
Assert.IsFalse(animation.IsPlaying(state.name));
|
||||
}
|
||||
}
|
||||
|
||||
public class Speed
|
||||
{
|
||||
[UnityTest]
|
||||
public IEnumerator State_Speed_SetTo_Zero_Time_DoesntAdvance([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.speed = 0f;
|
||||
state.enabled = true;
|
||||
yield return null;
|
||||
yield return null; //Second frame to allow Animation Component to advance time
|
||||
Assert.AreEqual(0f, state.time);
|
||||
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Speed_Negative_StopsState_WhenTime_Reaches_Negative([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.speed = -1f;
|
||||
state.enabled = true;
|
||||
yield return null;
|
||||
yield return null; //Second frame to allow Animation Component to advance time
|
||||
Assert.IsFalse(state.enabled);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Speed_Negative_DoesntStopsState_WhenTime_Reaches_Negative_OnLoopedClip([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance.wrapMode = WrapMode.Loop;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.speed = -1f;
|
||||
state.enabled = true;
|
||||
yield return null;
|
||||
yield return null; //Second frame to allow Animation Component to advance time
|
||||
Assert.IsTrue(state.enabled);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Speed_DoesntAffect_NormalizedTime([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance.wrapMode = WrapMode.Loop;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.time = 0.5f;
|
||||
float normalizedTime = state.normalizedTime;
|
||||
state.speed = 10.0f;
|
||||
Assert.AreEqual(normalizedTime, state.normalizedTime);
|
||||
}
|
||||
}
|
||||
|
||||
public class Name
|
||||
{
|
||||
[Test]
|
||||
public void State_Name_Equals_AddClip_Name([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
Assert.AreEqual("ValidName", state.name);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Name_ChangingName_Name_Equals_NewName([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.name = "NewName";
|
||||
Assert.AreEqual("NewName", state.name);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Name_ChangingName_DoesntInvalidate_State([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.name = "NewName";
|
||||
Assert.IsTrue(state.isValid);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Name_RenamedState_CantBeFound_ByOldName([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.name = "NewName";
|
||||
state = animation.GetState("ValidName");
|
||||
Assert.IsNull(state);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Name_RenamedState_CanBeFound_ByNewName([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.name = "NewName";
|
||||
state = animation.GetState("NewName");
|
||||
Assert.IsNotNull(state);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Name_EmptyString_CanBeFound([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.name = "";
|
||||
state = animation.GetState("");
|
||||
Assert.IsNotNull(state);
|
||||
}
|
||||
}
|
||||
|
||||
public class Weight
|
||||
{
|
||||
[UnityTest]
|
||||
public IEnumerator State_Weight_EqualZero_DoesntWrite([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
state.weight = 0f;
|
||||
state.time = 0.5f; //Seek the clip so that values should be written;
|
||||
yield return null;
|
||||
Assert.AreEqual(0f, animation.gameObject.transform.localPosition.x);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Weight_FlipFlopTest([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
state.weight = 0f;
|
||||
state.time = 0.5f; //Seek the clip so that values should be written;
|
||||
yield return null;
|
||||
Assert.AreEqual(0f, animation.gameObject.transform.localPosition.x);
|
||||
state.weight = 1f;
|
||||
yield return null;
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.x);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Weight_Normalizes([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clip2 = Resources.Load<AnimationClip>("LinearY");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
var clipInstance2 = Object.Instantiate<AnimationClip>(clip2);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
clipInstance2.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "State1");
|
||||
animation.AddClip(clipInstance2, "State2");
|
||||
IAnimationState state1 = animation.GetState("State1");
|
||||
IAnimationState state2 = animation.GetState("State2");
|
||||
state1.enabled = true;
|
||||
state2.enabled = true;
|
||||
state1.weight = 1f;
|
||||
state2.weight = 1f;
|
||||
state1.time = 0.5f; //Seek the clip so that values should be written;
|
||||
state2.time = 0.5f; //Seek the clip so that values should be written;
|
||||
yield return null;
|
||||
Assert.AreEqual(0.25f, animation.gameObject.transform.localPosition.x);
|
||||
Assert.AreEqual(0.25f, animation.gameObject.transform.localPosition.y);
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator State_Weight_NonZero_Writes([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
state.weight = 1f;
|
||||
state.time = 0.5f; //Seek the clip so that values should be written;
|
||||
yield return null;
|
||||
Assert.AreNotEqual(0f, animation.gameObject.transform.localPosition.x);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Weight_SetWeight_Equals_GetWeight([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.weight = 1f;
|
||||
Assert.AreEqual(1f, state.weight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Weight_InitialValue_IsZero([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
Assert.AreEqual(0f, state.weight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Weight_SetEnable_DoesntChange_Weight([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.enabled = true;
|
||||
Assert.AreEqual(0f, state.weight);
|
||||
state.weight = 1f;
|
||||
state.enabled = false;
|
||||
Assert.AreEqual(1f, state.weight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void State_Weight_SetWeight_DoesntChange_Enable([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
state.weight = 1f;
|
||||
Assert.IsFalse(state.enabled);
|
||||
state.enabled = true;
|
||||
state.weight = 0f;
|
||||
Assert.IsTrue(state.enabled);
|
||||
}
|
||||
}
|
||||
|
||||
public class Length
|
||||
{
|
||||
[Test]
|
||||
public void State_Length_Equals_ClipLength([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, "ValidName");
|
||||
IAnimationState state = animation.GetState("ValidName");
|
||||
Assert.AreEqual(clipInstance.length, state.length);
|
||||
}
|
||||
}
|
||||
|
||||
public class Clip
|
||||
{
|
||||
[Test]
|
||||
public void State_Clip_Equals_SetClip([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, clipInstance.name);
|
||||
IAnimationState state = animation.GetState(clipInstance.name);
|
||||
Assert.AreEqual(clipInstance, state.clip);
|
||||
}
|
||||
}
|
||||
|
||||
public class WrapModeTests
|
||||
{
|
||||
[Test]
|
||||
public void WrapMode_Equals_Clip_WrapMode([ValueSource(typeof(ComparativeTestFixture), "Sources")]System.Type type)
|
||||
{
|
||||
IAnimation animation = ComparativeTestFixture.Instantiate(type);
|
||||
var clip = Resources.Load<AnimationClip>("LinearX");
|
||||
var clipInstance = Object.Instantiate<AnimationClip>(clip);
|
||||
clipInstance.legacy = animation.usesLegacy;
|
||||
|
||||
animation.AddClip(clipInstance, clipInstance.name);
|
||||
IAnimationState state = animation.GetState(clipInstance.name);
|
||||
Assert.AreEqual(clipInstance.wrapMode, state.wrapMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cb3c934bf3f0534a8b954abe8c4984d
|
||||
timeCreated: 1498676303
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e443d0a02c421de4381e52acca42b6b8
|
||||
folderAsset: yes
|
||||
timeCreated: 1494560892
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
%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: FiresEvent
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings: []
|
||||
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: []
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_GenerateMotionCurves: 0
|
||||
m_Events:
|
||||
- time: 0.4
|
||||
functionName: Event
|
||||
data:
|
||||
objectReferenceParameter: {fileID: 0}
|
||||
floatParameter: 0
|
||||
intParameter: 0
|
||||
messageOptions: 0
|
||||
- time: 1
|
||||
functionName: Event
|
||||
data:
|
||||
objectReferenceParameter: {fileID: 0}
|
||||
floatParameter: 0
|
||||
intParameter: 0
|
||||
messageOptions: 0
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6daa07941d12d35499204edaf3412a35
|
||||
timeCreated: 1519669948
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,145 @@
|
||||
%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: LinearX
|
||||
serializedVersion: 6
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
inSlope: {x: Infinity, y: Infinity, z: Infinity}
|
||||
outSlope: {x: 1, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: {x: 1, y: 0, z: 0}
|
||||
inSlope: {x: 1, y: -0, z: -0}
|
||||
outSlope: {x: Infinity, y: Infinity, z: Infinity}
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path:
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 1
|
||||
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: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
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: 1
|
||||
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: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: 1
|
||||
tangentMode: 69
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 1
|
||||
outSlope: Infinity
|
||||
tangentMode: 69
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: 0
|
||||
tangentMode: 69
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: -0
|
||||
outSlope: Infinity
|
||||
tangentMode: 69
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: 0
|
||||
tangentMode: 69
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: -0
|
||||
outSlope: Infinity
|
||||
tangentMode: 69
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 1
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_GenerateMotionCurves: 0
|
||||
m_Events: []
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfc925af54b7a044bbc0364b9157fc0d
|
||||
timeCreated: 1492542614
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,138 @@
|
||||
%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: LinearXLegacy
|
||||
serializedVersion: 6
|
||||
m_Legacy: 1
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: {x: 0, y: 0, z: 0}
|
||||
inSlope: {x: Infinity, y: Infinity, z: Infinity}
|
||||
outSlope: {x: 1, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: {x: 1, y: 0, z: 0}
|
||||
inSlope: {x: 1, y: -0, z: -0}
|
||||
outSlope: {x: Infinity, y: Infinity, z: Infinity}
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path:
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 1
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings: []
|
||||
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: 1
|
||||
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: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: 1
|
||||
tangentMode: 69
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 1
|
||||
outSlope: Infinity
|
||||
tangentMode: 69
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: 0
|
||||
tangentMode: 69
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: -0
|
||||
outSlope: Infinity
|
||||
tangentMode: 69
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 2
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: 0
|
||||
tangentMode: 69
|
||||
- serializedVersion: 2
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: -0
|
||||
outSlope: Infinity
|
||||
tangentMode: 69
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 1
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_GenerateMotionCurves: 0
|
||||
m_Events: []
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e7cf6bd5ccd3f74e827f886ea59f0b1
|
||||
timeCreated: 1507816446
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user