private IEnumerator WaitToClose() { yield return(new WaitForSeconds(waitTime)); OTween.ValueTo(gameObject, ease, 0.0f, translateValue, easeTime, 0.0f, "StartClose", "UpdateCloseDoor", "EndClose"); GetComponent <AudioSource>().Play(); }
public static string ValueTo(GameObject obj, EaseType easeType, object startValue, object endValue, float duration, float delaytToStart = 0, string startCallBack = "", string updateCallBack = "", string endCallBack = "") { OTween ee = obj.AddComponent <OTween>(); ee.target = obj; ee.easeType = easeType; ee.delayToStart = delaytToStart; ee.duration = duration; ee.isStart = false; ee.startCallBack = startCallBack; ee.updateCallBack = updateCallBack; ee.endCallBack = endCallBack; ee.id = System.Guid.NewGuid().ToString(); if (startValue.GetType() == typeof(float)) { ee.variableType = VariableType.Float; ee.startValue1 = (float)startValue; ee.endValue1 = (float)endValue; } else if (startValue.GetType() == typeof(Vector2)) { ee.variableType = VariableType.V2; ee.startValue1 = ((Vector2)startValue).x; ee.startValue2 = ((Vector2)startValue).y; ee.endValue1 = ((Vector2)endValue).x; ee.endValue2 = ((Vector2)endValue).y; } else if (startValue.GetType() == typeof(Vector3)) { ee.variableType = VariableType.V3; ee.startValue1 = ((Vector3)startValue).x; ee.startValue2 = ((Vector3)startValue).y; ee.startValue3 = ((Vector3)startValue).z; ee.endValue1 = ((Vector3)endValue).x; ee.endValue2 = ((Vector3)endValue).y; ee.endValue3 = ((Vector3)endValue).z; } tweens.Add(ee); ee.StartEase(); return(ee.id); }
public void OpenDoor() { OTween.ValueTo(gameObject, ease, 0.0f, -translateValue, easeTime, 0.0f, "StartOpen", "UpdateOpenDoor", "EndOpen"); GetComponent <AudioSource>().Play(); }