public static Coroutine StartCoroutine(string methodName, object value = null) { if (behaviour == null) { var coroutineManager = new GameObject("CoroutineManager"); Object.DontDestroyOnLoad(coroutineManager); behaviour = coroutineManager.AddComponent <CoroutineBehaviour>(); } return(behaviour.StartCoroutine(methodName, value)); }
public override void execute(int frameRate, float delay) { if (!audioSource || !audioClip) { CoroutineBehaviour.StartCoroutineDelay(audioSource.gameObject, _StopClip, getWaitTime(frameRate, delay)); } else { AMTween.PlayAudio(audioSource, AMTween.Hash("delay", getWaitTime(frameRate, delay), "audioclip", audioClip, "loop", loop)); } }
public static Coroutine StartCoroutine(IEnumerator routine, bool bDestroyWhenLoadLevel) { if (!bDestroyWhenLoadLevel) { return mMain.StartCoroutine(routine); } if (mPrivate == null) { mPrivate = new GameObject("CoroutineManager").AddComponent<CoroutineBehaviour>(); } return mPrivate.StartCoroutine(routine); }
public static Coroutine StartCoroutine(IEnumerator routine, bool bDestroyWhenLoadLevel) { if (!bDestroyWhenLoadLevel) { return(mMain.StartCoroutine(routine)); } if (mPrivate == null) { mPrivate = new GameObject("CoroutineManager").AddComponent <CoroutineBehaviour>(); } return(mPrivate.StartCoroutine(routine)); }
public static Coroutine StartCoroutine(string methodName, bool destroyWhenChangeLevel, object value = null) { if (!destroyWhenChangeLevel && globalBehaviour != null) { return(globalBehaviour.StartCoroutine(methodName, value)); } if (sceneBehaviour == null) { sceneBehaviour = new GameObject("CoroutineManager").AddComponent <CoroutineBehaviour>(); } return(sceneBehaviour.StartCoroutine(methodName, value)); }
public static Coroutine StartCoroutine(IEnumerator routine, bool destroyWhenChangeLevel) { //use global MonoBehaviour exe coroutine if (!destroyWhenChangeLevel && globalBehaviour != null) { return(globalBehaviour.StartCoroutine(routine)); } //用当前场景内的MonoBehavior执行协成 if (sceneBehaviour == null) { sceneBehaviour = new GameObject("CoroutineManager").AddComponent <CoroutineBehaviour>(); } return(sceneBehaviour.StartCoroutine(routine)); }
public override void execute(int frameRate, float delay) { if (targetsAreEqual()) { return; } if ((endFrame == -1) || !component || ((fieldInfo == null) && (propertyInfo == null) && (methodInfo == null))) { return; } if (fieldInfo != null) { if (hasCustomEase()) { if (AMPropertyTrack.isValueTypeNumeric(valueType)) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_val, "to", end_val, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.Vector2) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_vect2, "to", end_vect2, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.Vector3) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_vect3, "to", end_vect3, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.Color) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_color, "to", end_color, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.Rect) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_vect2, "to", end_vect2, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.String) { CoroutineBehaviour.StartCoroutineDelay(component.gameObject, (x) => { fieldInfo.SetValue(component, start_str); }, getWaitTime(frameRate, delay)); } } else { if (AMPropertyTrack.isValueTypeNumeric(valueType)) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_val, "to", end_val, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.Vector2) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_vect2, "to", end_vect2, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.Vector3) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_vect3, "to", end_vect3, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.Color) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_color, "to", end_color, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.Rect) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "fieldinfo", fieldInfo, "from", start_vect2, "to", end_vect2, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.String) { CoroutineBehaviour.StartCoroutineDelay(component.gameObject, SetStringFunc, getWaitTime(frameRate, delay)); } } } else if (propertyInfo != null) { if (hasCustomEase()) { if (AMPropertyTrack.isValueTypeNumeric(valueType)) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_val, "to", end_val, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.Vector2) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_vect2, "to", end_vect2, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.Vector3) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_vect3, "to", end_vect3, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.Color) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_color, "to", end_color, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.Rect) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_vect2, "to", end_vect2, "easecurve", easeCurve)); } if (valueType == (int)AMPropertyTrack.ValueType.String) { CoroutineBehaviour.StartCoroutineDelay(component.gameObject, (x) => { propertyInfo.SetValue(component, start_str, null); }, getWaitTime(frameRate, delay)); } } else { if (AMPropertyTrack.isValueTypeNumeric(valueType)) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_val, "to", end_val, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.Vector2) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_vect2, "to", end_vect2, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.Vector3) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_vect3, "to", end_vect3, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.Color) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_color, "to", end_color, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.Rect) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "propertyinfo", propertyInfo, "from", start_vect2, "to", end_vect2, "easetype", (AMTween.EaseType)easeType)); } if (valueType == (int)AMPropertyTrack.ValueType.String) { CoroutineBehaviour.StartCoroutineDelay(component.gameObject, (x) => { propertyInfo.SetValue(component, start_str, null); }, getWaitTime(frameRate, delay)); } } } else if (methodInfo != null) { if (hasCustomEase()) { if (valueType == (int)AMPropertyTrack.ValueType.MorphChannels) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "methodtype", "morph", "methodinfo", methodInfo, "from", start_morph.ToArray(), "to", end_morph.ToArray(), "easecurve", easeCurve)); } } else { if (valueType == (int)AMPropertyTrack.ValueType.MorphChannels) { AMTween.PropertyTo(component, AMTween.Hash("delay", getWaitTime(frameRate, delay), "time", getTime(frameRate), "methodtype", "morph", "methodinfo", methodInfo, "from", start_morph.ToArray(), "to", end_morph.ToArray(), "easetype", (AMTween.EaseType)easeType)); } } } else { Debug.LogError("Animator: No FieldInfo or PropertyInfo set."); } }
private void Awake() { _instanceInner = this; }
public static void PerformAfterCoroutine <T>(this Action action, int frames = 1) where T : YieldInstruction, new() { CoroutineBehaviour.StartCoroutine <T>(action, frames); }