// public static void HideAndShow(MonoBehaviour sender ,string panelHide, string panelShow) { //hide menu GameObject.Find(panelHide).GetComponent<CanvasGroup>().interactable = false; sender.StartCoroutine(MenuBase.FadeHide(GameObject.Find(panelHide).GetComponent<CanvasGroup>())); //show GameObject diffObj = GameObject.Find(panelShow); diffObj.GetComponent<CanvasGroup>().interactable = true; sender.StartCoroutine(MenuBase.FadeShow(diffObj.GetComponent<CanvasGroup>())); MenuBase.BringToFront(diffObj); }
public IEnumerator CoroutinePunchOutAndInitialize(MonoBehaviour caller, XZPolygon polygon, bool bKeepInterior, GameObject zeObject, string strName, string strLayer, CustomMesh customMesh, Material material, bool bCollider) { float T = Time.time; yield return null; yield return caller.StartCoroutine(PunchOutStep1(polygon)); Debug.Log("(1)"); yield return null; Debug.Log("(2) Dt=" + (Time.time - T)); T = Time.time; yield return caller.StartCoroutine(PunchOutStep2(polygon)); yield return null; Debug.Log("(3) Dt=" + (Time.time - T)); T = Time.time; yield return caller.StartCoroutine(PunchOutStep3(polygon, bKeepInterior)); yield return null; Debug.Log("(4) Dt=" + (Time.time - T)); T = Time.time; if (zeObject == null) { zeObject = new GameObject(strName); zeObject.transform.parent = caller.transform; zeObject.transform.localPosition = Vector3.zero; zeObject.transform.localScale = Vector3.one; zeObject.layer = LayerMask.NameToLayer(strLayer); } customMesh.AttachMeshTo(zeObject, material); if (bCollider) { customMesh.AddMeshCollider(zeObject); } yield return null; Debug.Log("(5) Dt=" + (Time.time - T)); T = Time.time; caller.gameObject.SendMessage("OnPunchOutDone", zeObject); }
public static Task Login(MonoBehaviour owner, IPEndPoint endPoint, string id, string password, Action<string> progressReport) { var task = new UnitySlimTaskCompletionSource<bool>(); task.Owner = owner; owner.StartCoroutine(LoginCoroutine(endPoint, id, password, task, progressReport)); return task; }
/*******************************************************/ /* !@brief : リソースロード * @param[in] : path -> リソースパス * @param[in] : type -> リソースタイプ * @retval : Object * @date : 2014/05/02 * @author : コロソブス(korombus) *******************************************************/ public object Load(UnityEngine.MonoBehaviour MBeh, string path, System.Type type) { data = null; MBeh.StartCoroutine(create(MBeh, path, type)); Debug.Log(data); return(data); }
public StepControl(MasterPlayer player, MonoBehaviour context) { m_player = player; m_context = context; m_context.StartCoroutine(UpdateCo()); }
public void Callback(bool success,string response, List<RandomEvent> log, MonoBehaviour mb, string playId) { if(success) { mb.StartCoroutine(RegisterLog(log, playId)); } }
public static IEnumerator run_list(MonoBehaviour runner, IEnumerable<ActionWrapper> actions){ foreach (ActionWrapper aw in actions) { Debug.Log("Running Coroutine"); yield return runner.StartCoroutine(aw.run()); } yield return null; }
public static YieldInstruction Start(CanvasGroup group, MonoBehaviour script, float from, float to, float time) { Stop(group, script); var coroutine = script.StartCoroutine(AnimateGroup(group, from, to, time)); _fades.Add(group, coroutine); return coroutine; }
internal static IEnumerator Request(MonoBehaviour caller, EngageRequest request, EngageResponse response) { string requestJSON = request.ToJSON(); string url = DDNA.Instance.ResolveEngageURL(requestJSON); HttpRequest httpRequest = new HttpRequest(url); httpRequest.HTTPMethod = HttpRequest.HTTPMethodType.POST; httpRequest.HTTPBody = requestJSON; httpRequest.TimeoutSeconds = DDNA.Instance.Settings.HttpRequestEngageTimeoutSeconds; httpRequest.setHeader("Content-Type", "application/json"); System.Action<int, string, string> httpHandler = (statusCode, data, error) => { string engagementKey = "DDSDK_ENGAGEMENT_" + request.DecisionPoint + "_" + request.Flavour; if (error == null && statusCode >= 200 && statusCode < 300) { try { PlayerPrefs.SetString(engagementKey, data); } catch (Exception exception) { Logger.LogWarning("Unable to cache engagement: "+exception.Message); } } else { Logger.LogDebug("Engagement failed with "+statusCode+" "+error); if (PlayerPrefs.HasKey(engagementKey)) { Logger.LogDebug("Using cached response"); data = "{\"isCachedResponse\":true," + PlayerPrefs.GetString(engagementKey).Substring(1); } else { data = "{}"; } } response(data, statusCode, error); }; yield return caller.StartCoroutine(Network.SendRequest(httpRequest, httpHandler)); }
/*******************************************************/ /* !@brief : プレハブからオブジェクトをインスタンス * @param[in] : path -> リソースパス * @param[in] : type -> リソースタイプ * @param[in] : parent -> 親オブジェクトのTransform * @retval : Object * @date : 2014/05/02 * @author : コロソブス(korombus) *******************************************************/ public GameObject PrefabInstanceObj(UnityEngine.MonoBehaviour MBeh, string path, Transform parent, string objName) { MBeh.StartCoroutine(create(MBeh, path, typeof(GameObject), parent)); GameObject obj = data as GameObject; obj.name = objName; return(obj); }
public static void Init(MonoBehaviour behaviour) { if (inited) return; inited = true; behaviour.StartCoroutine(DistanceCheck()); }
public static AudioSourceFadeState FadeOut(this AudioSource source, MonoBehaviour behaviour = null, float waitDuration = 0f, float fadeDuration = 3f, bool stopOnFinished = true, Action finishedCallback = null) { behaviour = behaviour ?? AutoMonoBehaviour.Instantiate(source.gameObject); AudioSourceFadeState fadeState = new AudioSourceFadeState(source); behaviour.StartCoroutine(StartFadeOut(source, waitDuration, fadeDuration, stopOnFinished, finishedCallback, fadeState)); return fadeState; }
public static IEnumerator Build(MonoBehaviour target, params IEnumerator[] coroutines) { var monitors = new Monitor[coroutines.Length]; for (var i = 0; i < coroutines.Length; i++) target.StartCoroutine(monitors[i] = new Monitor(coroutines[i])); while (!AllDone(monitors)) yield return null; }
/////////////////////////////////////////////////////////////////////////////// // functions /////////////////////////////////////////////////////////////////////////////// // ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ public void Send( MonoBehaviour _sender ) { if ( delay <= Mathf.Epsilon ) { SendMessage (_sender); } else { _sender.StartCoroutine ( SendMessageDelay(_sender) ); } }
public void SendSignals( MonoBehaviour sender ) { if (hasFired == false || onlyOnce == false) { for (int i = 0; i < receivers.Length; i++) { sender.StartCoroutine(receivers[i].SendWithDelay(sender)); } hasFired = true; } }
public static void ChangeUseAvatar(MonoBehaviour behaviour, byte[] avatar, DelegateAPICallback callback) { if (avatar == null) { if (callback != null) callback(false, "ERROR: Không có dữ liệu về avatar mới."); return; } behaviour.StartCoroutine(UploadFile(avatar, callback)); }
/// <summary> /// Creates a customizable Draggable Area /// </summary> /// <param name="id">A unique ID.</param> /// <param name="rect">Area rect</param> /// <param name="drawAreaContent">Function for drawing custom content. This function is called in a GUILayout Area context. Returns Whether a Drag should start.</param> /// <param name="onClick">Function called if Move and Time Thresholds weren't broken before left mouse button was released.</param> /// <param name="onDragUpdate">Function called every Frame while dragging. Parameter: reference to the area rect. Constraints can be applied here.</param> /// <param name="onDrop">Function called when left mouse button is released</param> /// <param name="coroutineOwner">MonoBehaviour Instance that owns the coroutine. -> StopAllCoroutines will stop this if called on owner!!! Do not do that!!!</param> /// <param name="cancelOnRightClick">If true the drag canceles when the right mouse button is pressed. After cancelation the AreaRect returns to its startPosition</param> public static void DraggableArea(string id, Rect rect, DrawDraggableAreaFunc drawAreaContent, Action onClick, OnDragUpdateFunc onDragUpdate, Action <Rect> onDrop, UnityEngine.MonoBehaviour coroutineOwner, bool cancelOnRightClick = true) { Rect r = (draggedObjectID == id) ? draggedRect : rect; GUILayout.BeginArea(r); drawAreaContent(out bool beginDrag); if (beginDrag && draggedObjectID == null) { draggedObjectID = id; draggedRect = r; coroutineOwner.StartCoroutine(DraggableRectUpdate(onClick, onDragUpdate, onDrop, cancelOnRightClick)); } GUILayout.EndArea(); }
/// <summary> /// Creates a draggable Button /// </summary> /// <param name="id">A unique ID.</param> /// <param name="rect">Button rect</param> /// <param name="content">Button content</param> /// <param name="style">Style of the RepeatButton</param> /// <param name="onClick">Function called if Move and Time Thresholds weren't broken before left mouse button was released.</param> /// <param name="onDragUpdate">Function called every Frame while dragging. Parameter: reference to the button rect. Constraints can be applied here.</param> /// <param name="onDrop">Function called when left mouse button is released</param> /// <param name="coroutineOwner">MonoBehaviour Instance that owns the coroutine. -> StopAllCoroutines will stop this if called on owner </param> /// <param name="cancelOnRightClick">If true the drag canceles when the right mouse button is pressed. After cancelation the ButtonRect returns to its startPosition</param> public static void DraggableButton(string id, Rect rect, GUIContent content, GUIStyle style, Action onClick, OnDragUpdateFunc onDragUpdate, Action <Rect> onDrop, UnityEngine.MonoBehaviour coroutineOwner, bool cancelOnRightClick = true) { Rect r = (draggedObjectID == id) ? draggedRect : rect; if (GUI.RepeatButton(r, content, style)) { if (draggedObjectID == null) { draggedObjectID = id; draggedRect = r; coroutineOwner.StartCoroutine(DraggableRectUpdate(onClick, onDragUpdate, onDrop, cancelOnRightClick)); } } }
//basically Invoke /// <summary> /// Calls the specified code after the specified time has passed. /// </summary> /// <param name="code">The function to call.</param> /// <param name="time">The amount of time to wait before calling the code.</param> /// <param name="callingScript">The <see cref="MonoBehaviour"/> to run the Coroutine on.</param> /// <param name="mode">The time mode to run the Coroutine with.</param> /// <returns></returns> public static IEnumerator FireAndForgetRoutine(CallbackMethod code, float time, MonoBehaviour callingScript, Mode mode = Mode.UPDATE) { switch(mode) { case Mode.UPDATE: case Mode.FIXEDUPDATE: yield return new WaitForSeconds(time); break; case Mode.REALTIME: yield return callingScript.StartCoroutine(WaitForRealSecondsRoutine(time)); break; } code(); }
static public int StartCoroutine_Auto(IntPtr l) { try { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.Collections.IEnumerator a1; checkType(l, 2, out a1); var ret = self.StartCoroutine(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
public static IEnumerator sendSimple(UnityEngine.MonoBehaviour mo, IBuilderLite build, PacketHolder par) { var bundle = new Bundle(); var data = build.WeakBuild(); Log.Net("send Simple " + bundle + " " + data); /* * After Build builder Clear */ bundle.newMessage(data.GetType()); var fid = bundle.writePB(data); //Log.Net ("Perhaps network not ok"); yield return(mo.StartCoroutine(bundle.sendCoroutine(KBEngine.KBEngineApp.app.networkInterface(), fid, par))); }
/// <summary> /// </summary> /// <param name="net">An object to interact with the network.</param> /// <param name="host">Host of the collector server.</param> /// <param name="trackingCode">Tracking code for the game.</param> /// <param name="authorization">Authorization to start the tracking.</param> public NetStorage (MonoBehaviour behaviour, string host, string trackingCode) { this.net = new Net (behaviour); this.host = host; this.trackingCode = trackingCode; this.authorization = "a:"; string filePath = Application.dataPath + "/Assets/track.txt"; if (Application.platform != RuntimePlatform.WebGLPlayer) { filePath = "file:///" + filePath; } WWW www = new WWW(filePath); behaviour.StartCoroutine(WaitForRequest(www)); }
public static int StartCoroutine2_wrap(long L) { try { long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.MonoBehaviour obj = get_obj(nThisPtr); string arg0 = FCLibHelper.fc_get_string_a(L, 0); UnityEngine.Coroutine ret = obj.StartCoroutine(arg0); long ret_ptr = FCLibHelper.fc_get_return_ptr(L); long v = FCGetObj.PushObj(ret); FCLibHelper.fc_set_value_wrap_objptr(ret_ptr, v); } catch (Exception e) { Debug.LogException(e); } return(0); }
static public int StartCoroutine(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(System.Collections.IEnumerator))) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.Collections.IEnumerator a1; checkType(l, 2, out a1); var ret = self.StartCoroutine(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 2, typeof(string))) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.StartCoroutine(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); var ret = self.StartCoroutine(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
public void Connect() { main = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Main>(); if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) { filepath = Application.dataPath + "/StreamingAssets/" + db_name; } else { filepath = Application.persistentDataPath + "/" + db_name; } if (!System.IO.File.Exists (filepath)) { main.StartCoroutine (LoadDBMethod (db_name)); } else { string conn = "URI=file:" + filepath; dbconn = new SqliteConnection(conn); dbconn.Open(); dbcmd = dbconn.CreateCommand(); } }
public static int StartCoroutine_wrap(long L) { try { long VM = FCLibHelper.fc_get_vm_ptr(L); long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.MonoBehaviour obj = get_obj(nThisPtr); System.Collections.IEnumerator arg0 = FCGetObj.GetObj <System.Collections.IEnumerator>(FCLibHelper.fc_get_wrap_objptr(L, 0)); UnityEngine.Coroutine ret = obj.StartCoroutine(arg0); long ret_ptr = FCLibHelper.fc_get_return_ptr(L); long v = FCGetObj.PushObj(ret); FCLibHelper.fc_set_value_wrap_objptr(VM, ret_ptr, v); } catch (Exception e) { Debug.LogException(e); } return(0); }
public Coroutine RunCoroutine(IEnumerator routine, MonoBehaviour mb = null) { mb = mb ?? coroutineBehaviour; var ci = new CoroutineInstance(); ci.mb = mb; var cor = mb.StartCoroutine(ci.ContainerCoroutine(routine)); ci.coroutine = new GenericWeakReference<Coroutine>(cor); if (ci.coroutine != null) { ci.OnRoutineFinished += OnCoroutineFinshed; ci.OnRoutineStopped += OnCoroutineFinshed; activeRoutines.Add(ci); } return cor; }
public void RegisterPlay(MonoBehaviour mb, string stageID, int totalCorrect, float successRate, List<RandomEvent> log) { WWW www = null; WWWForm form = new WWWForm (); form.AddField ("playerAlias", PlayerInfo.alias); form.AddField ("gender", PlayerInfo.gender); form.AddField ("age", PlayerInfo.age); form.AddField ("education", PlayerInfo.education); form.AddField ("destro", PlayerInfo.destro); form.AddField ("totalPlays", log.Count.ToString()); form.AddField ("totalCorrect", totalCorrect.ToString()); form.AddField ("successRate", successRate.ToString()); var playId = PlayerInfo.alias+","+DateTime.Now.ToShortDateString().Replace("/", "")+","+DateTime.Now.Hour+DateTime.Now.Minute+DateTime.Now.Second; form.AddField ("playID", playId); form.AddField ("stageID", stageID); string loginURL = webProtocol + gameServerLocation + "/insertPlay"; www = new WWW (loginURL, form); mb.StartCoroutine (WaitRegister (www, Callback, log, mb, playId)); }
public void Start(MonoBehaviour behaviour, SequencerInstance instance, string stateName) { if(stateName == null) { stateName = sequenceDefaultState; } mCurState = stateName; if(!string.IsNullOrEmpty(stateName)) { if(mSequences != null) { Sequencer seq; if(mSequences.TryGetValue(stateName, out seq)) { behaviour.StartCoroutine(seq.Go(instance, behaviour)); } else { Debug.LogError("State not found: "+stateName, behaviour); } } } }
static public int StartCoroutine(IntPtr l) { try{ if (matchType(l, 2, typeof(System.Collections.IEnumerator))) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.Collections.IEnumerator a1; checkType(l, 2, out a1); UnityEngine.Coroutine ret = self.StartCoroutine(a1); pushValue(l, ret); return(1); } else if (matchType(l, 2, typeof(string), typeof(System.Object))) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); UnityEngine.Coroutine ret = self.StartCoroutine(a1, a2); pushValue(l, ret); return(1); } else if (matchType(l, 2, typeof(string))) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.String a1; checkType(l, 2, out a1); UnityEngine.Coroutine ret = self.StartCoroutine(a1); pushValue(l, ret); return(1); } LuaDLL.luaL_error(l, "No matched override function to call"); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static int QPYX_StartCoroutine_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <string>(L_YXQP, 2)) { UnityEngine.MonoBehaviour QPYX_obj_YXQP = (UnityEngine.MonoBehaviour)ToLua.CheckObject <UnityEngine.MonoBehaviour>(L_YXQP, 1); string QPYX_arg0_YXQP = ToLua.ToString(L_YXQP, 2); UnityEngine.Coroutine QPYX_o_YXQP = QPYX_obj_YXQP.StartCoroutine(QPYX_arg0_YXQP); ToLua.PushSealed(L_YXQP, QPYX_o_YXQP); return(1); } else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <System.Collections.IEnumerator>(L_YXQP, 2)) { UnityEngine.MonoBehaviour QPYX_obj_YXQP = (UnityEngine.MonoBehaviour)ToLua.CheckObject <UnityEngine.MonoBehaviour>(L_YXQP, 1); System.Collections.IEnumerator QPYX_arg0_YXQP = (System.Collections.IEnumerator)ToLua.ToObject(L_YXQP, 2); UnityEngine.Coroutine QPYX_o_YXQP = QPYX_obj_YXQP.StartCoroutine(QPYX_arg0_YXQP); ToLua.PushSealed(L_YXQP, QPYX_o_YXQP); return(1); } else if (QPYX_count_YXQP == 3) { UnityEngine.MonoBehaviour QPYX_obj_YXQP = (UnityEngine.MonoBehaviour)ToLua.CheckObject <UnityEngine.MonoBehaviour>(L_YXQP, 1); string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2); object QPYX_arg1_YXQP = ToLua.ToVarObject(L_YXQP, 3); UnityEngine.Coroutine QPYX_o_YXQP = QPYX_obj_YXQP.StartCoroutine(QPYX_arg0_YXQP, QPYX_arg1_YXQP); ToLua.PushSealed(L_YXQP, QPYX_o_YXQP); return(1); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.MonoBehaviour.StartCoroutine")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
public void Update(MonoBehaviour mono, UpdateState gameState) { int rotX = 0; int rotY = 0; int rotZ = 0; if (_readyToRot) { rotX = Input.GetKey(KeyCode.S) ? -1 : rotX; rotX = Input.GetKey(KeyCode.W) ? 1 : rotX; rotY = Input.GetKey(KeyCode.A) ? 1 : rotY; rotY = Input.GetKey(KeyCode.D) ? -1 : rotY; rotZ = Input.GetKey(KeyCode.E) ? -1 : rotZ; rotZ = Input.GetKey(KeyCode.Q) ? 1 : rotZ; bool alternate = Input.GetKey(KeyCode.LeftShift); if ((rotX != 0) || (rotY != 0) || (rotZ != 0)) { foreach (SplitSide splitRotation in _splitSides) { int w = rotX != 0 && splitRotation.Axis.Equals(Vector3.right) ? rotX : rotY != 0 && splitRotation.Axis.Equals(Vector3.up) ? rotY : rotZ != 0 && splitRotation.Axis.Equals(Vector3.forward) ? rotZ : 0; if ((w != 0) && (splitRotation.Lhs != alternate)) { TreeRotater.Direction direction = TreeRotater.DirectionFromInt(w); IList<RotationAnimator> animators = _treeRotater.Rotate(splitRotation, direction); _readyToRot = false; _eventRegistry.Notify(new GameEvent(GameEvent.Type.PAUSED)); mono.StartCoroutine(Rotate90Degrees(splitRotation, animators)); //break; } } } } }
public static void Start(MonoBehaviour mono, Text _textObjectS = null, Text _textObjectM = null) { isPaused = false; Reset(); if (mono == null) { Debug.LogError("Behaviour may not be null!"); return; } if (_textObjectS != null && _textObjectM != null) { textObjectM = _textObjectM; textObjectS = _textObjectS; } else { Debug.LogError("No Text object!"); return; } Behaviour = mono; Behaviour.StartCoroutine(WaitForTimerUpdate()); isStarted = true; }
void DoStartCoroutine() { GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) return; component = go.GetComponent(behaviour.Value) as MonoBehaviour; if (component == null) { LogWarning("StartCoroutine: " + go.name + " missing behaviour: " + behaviour.Value); return; } switch (functionCall.ParameterType) { case "None": component.StartCoroutine(functionCall.FunctionName); return; case "int": component.StartCoroutine(functionCall.FunctionName, functionCall.IntParameter.Value); return; case "float": component.StartCoroutine(functionCall.FunctionName, functionCall.FloatParameter.Value); return; case "string": component.StartCoroutine(functionCall.FunctionName, functionCall.StringParameter.Value); return; case "GameObject": component.StartCoroutine(functionCall.FunctionName, functionCall.GameObjectParameter.Value); return; case "Object": component.StartCoroutine(functionCall.FunctionName, functionCall.ObjectReferenceParameter); return; } }
void DoStartCoroutine() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { return; } component = go.GetComponent(behaviour.Value) as MonoBehaviour; if (component == null) { LogWarning("StartCoroutine: " + go.name + " missing behaviour: " + behaviour.Value); return; } switch (functionCall.ParameterType) { case "None": component.StartCoroutine(functionCall.FunctionName); return; case "int": component.StartCoroutine(functionCall.FunctionName, functionCall.IntParameter.Value); return; case "float": component.StartCoroutine(functionCall.FunctionName, functionCall.FloatParameter.Value); return; case "string": component.StartCoroutine(functionCall.FunctionName, functionCall.StringParameter.Value); return; case "bool": component.StartCoroutine(functionCall.FunctionName, functionCall.BoolParameter.Value); return; case "Vector3": component.StartCoroutine(functionCall.FunctionName, functionCall.Vector3Parameter.Value); return; case "Rect": component.StartCoroutine(functionCall.FunctionName, functionCall.RectParamater.Value); return; case "GameObject": component.StartCoroutine(functionCall.FunctionName, functionCall.GameObjectParameter.Value); return; case "Material": component.StartCoroutine(functionCall.FunctionName, functionCall.MaterialParameter.Value); break; case "Texture": component.StartCoroutine(functionCall.FunctionName, functionCall.TextureParameter.Value); break; case "Quaternion": component.StartCoroutine(functionCall.FunctionName, functionCall.QuaternionParameter.Value); break; case "Object": component.StartCoroutine(functionCall.FunctionName, functionCall.ObjectParameter.Value); return; } }
//Click action ( button down) public static void HandleClick(MonoBehaviour script) { if (_CurrentInteractible != null) { if (clicking == false) { script.StartCoroutine(preformClick()); clicking = true; } } }
public static UnityEngine.Coroutine New(MonoBehaviour animatorSibling, string stateName) { return animatorSibling.StartCoroutine( new WaitForAnimationState(animatorSibling, stateName) ); }
private void ExecuteOnSerialize(MonoBehaviour monob, PhotonStream pStream, PhotonMessageInfo info) { object[] paramsX = new object[2]; paramsX[0] = pStream; paramsX[1] = info; MethodInfo methodI = this.GetCachedMethod(monob, PhotonNetworkingMessage.OnPhotonSerializeView); if (methodI != null) { object result = methodI.Invoke((object)monob, paramsX); if (methodI.ReturnType == typeof(System.Collections.IEnumerator)) { monob.StartCoroutine((IEnumerator)result); } } else { Debug.LogError("Tried to run " + PhotonNetworkingMessage.OnPhotonSerializeView + ", but this method was missing on: " + monob); } }
public void Start(UnityEngine.MonoBehaviour comp) { client.BeginReceive(RecvAsync, null); comp.StartCoroutine(Dispatcher()); }
public static void InitializeServices(Type targetType, UnityEngine.MonoBehaviour coroutineComponent) { coroutineComponent.StartCoroutine(InitializeCoroutine(targetType)); }
static int StartCoroutine(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && ToLua.CheckTypes(L, 1, typeof(UnityEngine.MonoBehaviour), typeof(string))) { UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Coroutine o = null; try { o = obj.StartCoroutine(arg0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } ToLua.PushObject(L, o); return(1); } else if (count == 2 && ToLua.CheckTypes(L, 1, typeof(UnityEngine.MonoBehaviour), typeof(System.Collections.IEnumerator))) { UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.ToObject(L, 1); System.Collections.IEnumerator arg0 = (System.Collections.IEnumerator)ToLua.ToObject(L, 2); UnityEngine.Coroutine o = null; try { o = obj.StartCoroutine(arg0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } ToLua.PushObject(L, o); return(1); } else if (count == 3 && ToLua.CheckTypes(L, 1, typeof(UnityEngine.MonoBehaviour), typeof(string), typeof(object))) { UnityEngine.MonoBehaviour obj = (UnityEngine.MonoBehaviour)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); object arg1 = ToLua.ToVarObject(L, 3); UnityEngine.Coroutine o = null; try { o = obj.StartCoroutine(arg0, arg1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } ToLua.PushObject(L, o); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.MonoBehaviour.StartCoroutine"); } return(0); }
/// <summary> /// Fire Delayed /// Fires an KIXEvent after a defined delay in ms. /// </summary> /// <param name="e">KIXEvent to fire</param> /// <param name="delayInMS">float</param> /// <param name="sender">object</param> public void FireDelayed(KIXEvent e, int delayInMS, UnityEngine.MonoBehaviour sender) { sender.StartCoroutine(FireDelayedEvent(e, delayInMS)); }
public MasterPlayer(MonoBehaviour context) { m_state = State.NotPlaying; m_context = context; m_context.StartCoroutine(UpdateCo()); }
static public int StartCoroutine(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(string))) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.StartCoroutine(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 2, typeof(System.Collections.IEnumerator))) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.Collections.IEnumerator a1; checkType(l, 2, out a1); var ret = self.StartCoroutine(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 2, typeof(SLua.LuaFunction))) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); SLua.LuaFunction a2; checkType(l, 2, out a2); var ret = self.StartCoroutine(a2); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { UnityEngine.MonoBehaviour self = (UnityEngine.MonoBehaviour)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Object a2; checkType(l, 3, out a2); var ret = self.StartCoroutine(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function StartCoroutine to call"); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
/// <summary> /// Spawns a simple coroutine which waits 'time' seconds and then invokes the provided action. /// </summary> public static void WaitAndDo(MonoBehaviour script, float time, Action action) { script.StartCoroutine (waitAndDoRoutine (time, action)); }
/// <summary> /// Uploads the current screen shot image to the user's social page on the given Provider. /// Supported platforms: Facebook /// /// NOTE: This operation requires a successful login. /// </summary> /// <param name="mb">Mb.</param> /// <param name="provider">The <c>Provider</c> the given screenshot should be uploaded to.</param> /// <param name="title">The title of the screenshot.</param> /// <param name="message">Message to post with the screenshot.</param> /// <param name="payload">A string to receive when the function returns.</param> /// <param name="reward">A <c>Reward</c> to give the user after a successful upload.</param> public static void UploadCurrentScreenShot(MonoBehaviour mb, Provider provider, string title, string message, string payload="", Reward reward = null) { mb.StartCoroutine(TakeScreenshot(provider, title, message, payload, reward)); }
public IEnumerator StartCoroutine(string script, UnityEngine.MonoBehaviour coroutine) { var expr = CQ_Compiler.CompileParagraph(script); //语法分析 yield return(coroutine.StartCoroutine(expr.CoroutineCompute(content, coroutine))); }