private IEnumerator ShowModelTask(string name, string motionName, bool motionLoop, string expressionName, Vector3 position, float duration) { L2DModel model = LoadModel(name); if (model == null) { yield break; } model.SetActivate(true); model.SetEyeBlinkEnabled(false); if (expressionName == "") { model.ClearExpression(true); } else { model.SetExpression(expressionName, true); } model.SetMotion(motionName, motionLoop, true); model.SetPosition(position); float startTime = Time.time; while (Time.time - (startTime + duration) < 0.0f) { float rate = (Time.time - startTime) / duration; model.SetAlpha(Mathf.Lerp(0.0f, 1.0f, rate)); yield return(null); } model.SetAlpha(1.0f); }
private IEnumerator ModelPositionTask(L2DModel model) { model.SetPosition(_Position); float startTime = Time.time; while (Time.time - (startTime + _Duration) < 0.0f) { float rate = (Time.time - startTime) / _Duration; model.SetAlpha(Mathf.Lerp(0.0f, 1.0f, rate)); yield return(null); } model.SetAlpha(1.0f); }
private IEnumerator HideModelTask(string name, float duration) { L2DModel model = GetActiveModel(name); if (model == null) { Debug.LogError("Not exist activated model " + name); yield break; } float startTime = Time.time; while (Time.time - (startTime + duration) < 0.0f) { float rate = (Time.time - startTime) / duration; model.SetAlpha(Mathf.Lerp(1.0f, 0.0f, rate)); yield return(null); } model.SetActivate(false); }