public void Start()
{
// Get the values of the parameters:
layerIndex = GetParameterAsInt(0, 1);
weight = GetParameterAsFloat(1, 1);
subject = GetSubject(2);
duration = GetParameterAsFloat(3, 0);
if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AnimatorLayer({1}, {2}, {3}, {4})", new System.Object[] { DialogueDebug.Prefix, layerIndex, weight, subject, duration }));
// Check the parameters:
if (subject == null) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): subject '{1}' wasn't found.", new System.Object[] { DialogueDebug.Prefix, GetParameter(2) }));
Stop();
} else {
animator = subject.GetComponentInChildren<Animator>();
if (animator == null) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): no Animator found on '{1}'.", new System.Object[] { DialogueDebug.Prefix, subject.name }));
Stop();
} else if ((layerIndex < 1) || (layerIndex >= animator.layerCount)) {
if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AnimatorLayer(): layer index {1} is invalid.", new System.Object[] { DialogueDebug.Prefix, layerIndex }));
Stop();
} else if (duration < SmoothMoveCutoff) {
Stop();
} else {
// Set up the lerp:
startTime = DialogueTime.time;
endTime = startTime + duration;
originalWeight = animator.GetLayerWeight(layerIndex);
}
}
}