IEnumerator BlinkRoutine() { while (true) { var waitTime = Time.time + Random.value * m_interVal; while (waitTime > Time.time) { if (Request) { m_request = false; break; } yield return(null); } // close var value = 0.0f; var closeSpeed = 1.0f / m_closeSeconds; while (true) { value += Time.deltaTime * closeSpeed; if (value >= 1.0f) { break; } BlendShapes.SetValue(BlendShapePreset.Blink, value); yield return(null); } BlendShapes.SetValue(BlendShapePreset.Blink, 1.0f); // wait... yield return(new WaitForSeconds(m_closingTime)); // open value = 1.0f; var openSpeed = 1.0f / m_openingSeconds; while (true) { value -= Time.deltaTime * openSpeed; if (value < 0) { break; } BlendShapes.SetValue(BlendShapePreset.Blink, value); yield return(null); } BlendShapes.SetValue(BlendShapePreset.Blink, 0); } }
void ApplyRotations(float yaw, float pitch) { #pragma warning disable 0618 if (yaw < 0) { // Left m_proxy.SetValue(BlendShapePreset.LookRight, 0, !m_notSetValueApply); // clear first m_proxy.SetValue(BlendShapePreset.LookLeft, Mathf.Clamp(Horizontal.Map(-yaw), 0, 1.0f), !m_notSetValueApply); } else { // Right m_proxy.SetValue(BlendShapePreset.LookLeft, 0, !m_notSetValueApply); // clear first m_proxy.SetValue(BlendShapePreset.LookRight, Mathf.Clamp(Horizontal.Map(yaw), 0, 1.0f), !m_notSetValueApply); } if (pitch < 0) { // Down m_proxy.SetValue(BlendShapePreset.LookUp, 0, !m_notSetValueApply); // clear first m_proxy.SetValue(BlendShapePreset.LookDown, Mathf.Clamp(VerticalDown.Map(-pitch), 0, 1.0f), !m_notSetValueApply); } else { // Up m_proxy.SetValue(BlendShapePreset.LookDown, 0, !m_notSetValueApply); // clear first m_proxy.SetValue(BlendShapePreset.LookUp, Mathf.Clamp(VerticalUp.Map(pitch), 0, 1.0f), !m_notSetValueApply); } #pragma warning restore 0618 }
void ApplyRotations(float yaw, float pitch) { if (yaw < 0) { // Left m_propxy.SetValue(BlendShapePreset.LookLeft, Horizontal.Map(-yaw)); m_propxy.SetValue(BlendShapePreset.LookRight, 0); } else { // Right m_propxy.SetValue(BlendShapePreset.LookLeft, 0); m_propxy.SetValue(BlendShapePreset.LookRight, Horizontal.Map(yaw)); } if (pitch < 0) { // Down m_propxy.SetValue(BlendShapePreset.LookUp, 0); m_propxy.SetValue(BlendShapePreset.LookDown, VerticalDown.Map(-pitch)); } else { // Up m_propxy.SetValue(BlendShapePreset.LookUp, VerticalUp.Map(pitch)); m_propxy.SetValue(BlendShapePreset.LookDown, 0); } }
IEnumerator RoutineNest(BlendShapePreset preset, float velocity, float wait) { for (var value = 0.0f; value <= 1.0f; value += velocity) { BlendShapes.SetValue(preset, value); yield return(null); } BlendShapes.SetValue(preset, 1.0f); yield return(new WaitForSeconds(wait)); for (var value = 1.0f; value >= 0; value -= velocity) { BlendShapes.SetValue(preset, value); yield return(null); } BlendShapes.SetValue(preset, 0); yield return(new WaitForSeconds(wait * 2)); }
public void Slider() { if (m_target.BlendShapeAvatar == null) { return; } var oldValue = m_target.GetValue(m_key); var newValue = EditorGUILayout.Slider(m_key.ToString(), oldValue, 0, 1.0f); if (oldValue != newValue) { m_target.SetValue(m_key, newValue); } }
public void Slider() { if (m_target.BlendShapeAvatar == null) { return; } var oldValue = m_target.GetValue(m_key); var enable = GUI.enabled; GUI.enabled = Application.isPlaying; var newValue = EditorGUILayout.Slider(m_key.ToString(), oldValue, 0, 1.0f); GUI.enabled = enable; if (Application.isPlaying && oldValue != newValue) { m_target.SetValue(m_key, newValue); } }