Наследование: YieldInstruction
Пример #1
0
    private IEnumerator DisableSkyBoxCR(float timeOffset)
    {
        WaitForEndOfFrame endOfFrame = new WaitForEndOfFrame();

        float time = 0.0f;
        while (time < timeOffset)
        {
            time += Time.deltaTime;
            yield return endOfFrame;
        }

        SetActve(true);

        StartCoroutine(TransitionManager.Instance.FadeContent(
            gameObject,
            TransitionManager.FadeType.FadeOut,
            TransitionManager.Instance.TransitionTimeSkyboxFadeOut,
            TransitionManager.Instance.OpacityCurveSkyboxFadeOut));

        time = 0.0f;
        while (time < TransitionManager.Instance.TransitionTimeSkyboxFadeOut)
        {
            time += Time.deltaTime;
            yield return endOfFrame;
        }

        // if there is not a fade in our future, we can deactivate the game object; otherwise, fades
        // will not work because Update() is not called on inactive objects
        if (--fadingRefCount == 0)
        {
            SetActve(false);
        }
    }
 static public int constructor(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
         UnityEngine.WaitForEndOfFrame o;
         o = new UnityEngine.WaitForEndOfFrame();
         pushValue(l, true);
         pushValue(l, o);
         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
 }
Пример #3
0
 private IEnumerator getPath(Vector3 target)
 {
     lookTarget = target;
     var waitUpdate = new WaitForEndOfFrame();
     myAgent.SetDestination(target);
     while (myAgent.pathPending)
         yield return waitUpdate;
     myAgent.Stop();
     path = myAgent.path;
 }
Пример #4
0
        IEnumerator EndOfFrames()
        {
            UnityEngine.WaitForEndOfFrame wait = new UnityEngine.WaitForEndOfFrame();
            while (true)
            {
                yield return(wait);

                Loop(Process.EndOfFrames);
            }
        }
 IEnumerator RandomInputJump()
 {
     var waitForEndOfFrame = new WaitForEndOfFrame();
     while (true)
     {
         _fakeInputJump = true;
         yield return waitForEndOfFrame;
         yield return waitForEndOfFrame;
         _fakeInputJump = false;
         yield return new WaitForSeconds(Random.Range(.2f, 1f));
     }
 }
Пример #6
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.WaitForEndOfFrame o;
         o = new UnityEngine.WaitForEndOfFrame();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.WaitForEndOfFrame o;
         o=new UnityEngine.WaitForEndOfFrame();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Пример #8
0
	void Awake()
	{
		instance = this;
		cachedTransform = transform;
		waitEndOfFrame = new WaitForEndOfFrame();
		
		if (Screen.width >= Screen.height) {
			OrientationChanged(ScreenOrientation.Landscape);
		}
		else {
			OrientationChanged(ScreenOrientation.Portrait);
		}
	}
Пример #9
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.WaitForEndOfFrame o;
         o = new UnityEngine.WaitForEndOfFrame();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.WaitForEndOfFrame o;
         o=new UnityEngine.WaitForEndOfFrame();
         pushValue(l,true);
         pushValue(l,o);
         return 2;
     }
     catch(Exception e) {
         return error(l,e);
     }
 }
    private IEnumerator ReflectionProbeUpdate()
    {
        var waiter = new WaitForEndOfFrame();
        var currentSlice = -1;
        for (;;)
        {
            for (int i = 0; i < 2; i++)
                yield return waiter;

            currentSlice = reflectionProbe.RenderProbe();

            while (!reflectionProbe.IsFinishedRendering(currentSlice))
                yield return waiter;
        }
    }
Пример #12
0
	public void Awake()
	{
		waitEndOfFrame = new WaitForEndOfFrame();
			
		if(instance == null)
		{
			instance = this;
			allFreezers = new List<FreezerTile>(20);
			Match3BoardGameLogic.Instance.loseConditions.OnNewMove += OnNewMove;
			Match3BoardGameLogic.OnPostStableBoard += OnPostStableBoard;
		}
		else
		{
			Destroy (this);
		}
	}
Пример #13
0
	IEnumerator FadeinCoroutine (float time, System.Action action)
	{
		float endTime = Time.timeSinceLevelLoad + time * (1 - cutoutRange);
		
		var endFrame = new WaitForEndOfFrame ();

		while (Time.timeSinceLevelLoad <= endTime) {
			cutoutRange = 1 - ((endTime - Time.timeSinceLevelLoad) / time);
			fade.UpdateMaskCutout (cutoutRange);
			yield return endFrame;
		}
		cutoutRange = 1;
		fade.UpdateMaskCutout (cutoutRange);

		if (action != null) {
			action ();
		}
	}
Пример #14
0
    private IEnumerator EnableSkyBoxCR(float timeOffset)
    {
        WaitForEndOfFrame endOfFrame = new WaitForEndOfFrame();

        float time = 0.0f;
        while (time < timeOffset)
        {
            time += Time.deltaTime;
            yield return endOfFrame;
        }

        SetActve(true);

        StartCoroutine(TransitionManager.Instance.FadeContent(
            gameObject,
            TransitionManager.FadeType.FadeIn,
            TransitionManager.Instance.TransitionTimeSkyboxFadeIn,
            TransitionManager.Instance.OpacityCurveSkyboxFadeIn));

        --fadingRefCount;
    }
Пример #15
0
        IEnumerator Start () 
        {
            var waitForEndFrame = new WaitForEndOfFrame();

            while (true)
            {
                yield return waitForEndFrame;

                for (int i = _endOfFrameTicked.Count - 1; i >= 0; --i)
                {
                    try
                    {
                        _endOfFrameTicked[i].EndOfFrameTick(Time.deltaTime);
                    }
                    catch (Exception e)
                    {
                        Utility.Console.LogException(e);
                    }
                }
            }
        }
    static int _CreateUnityEngine_WaitForEndOfFrame(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UnityEngine.WaitForEndOfFrame obj = new UnityEngine.WaitForEndOfFrame();
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.WaitForEndOfFrame.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #17
0
	void Awake() 
	{
		waitEndFrame = new WaitForEndOfFrame();
	}
Пример #18
0
        /// <summary>
        /// Called after the Awake() and before any update is called.
        /// </summary>
        public IEnumerator Start()
        {
            // Initialize the manager
            InputManager.Initialize();

            // Create the coroutine here so we don't re-create over and over
            WaitForEndOfFrame lWaitForEndOfFrame = new WaitForEndOfFrame();

            // Loop endlessly so we can process the input
            // at the end of each frame, preparing for the next
            while (true)
            {
                yield return lWaitForEndOfFrame;
                InputManager.Update();
            }
        }
Пример #19
0
        /// <summary>
        /// Called after the Awake() and before any update is called.
        /// </summary>
        public IEnumerator Start()
        {
            // Create the coroutine here so we don't re-create over and over
            WaitForEndOfFrame lWaitForEndOfFrame = new WaitForEndOfFrame();

            // Loop endlessly so we can flag when we're done with the frame
            while (true)
            {
                yield return lWaitForEndOfFrame;

                // Update the frame index for messages that need to be sent next update.
                // Since the max value of an int is 2,147,483,647, we can run 60FPS
                // for 414 days straight before we hit it. So... we won't worry about extra logic.
                MessageDispatcher.FrameIndex++;
            }
        }
Пример #20
0
	protected override void Awake () 
	{
		base.Awake();
		
		waitEndOfFrame = new WaitForEndOfFrame();
		
		tileModelTransform = cachedTransform.Find("Model");
		tileModelRenderer = tileModelTransform.renderer;
		tileModelLocalPos = tileModelTransform.localPosition;
	}
Пример #21
0
        /// <summary>
        /// Start this instance.
        /// </summary>
        public IEnumerator Start()
        {
            Log.FilePath = _FilePath;
            Log.FontSize = _ScreenFontSize;
            Log.ForeColor = _ScreenForeColor;
            Log.LineHeight = _ScreenFontSize + 6;
            Log.PrefixTime = _PrefixTime;
            Log.IsFileEnabled = _IsFileEnabled;
            Log.IsScreenEnabled = _IsScreenEnabled;
            Log.IsConsoleEnabled = _IsConsoleEnabled;
            Log.FileFlushPerWrite = _FileFlushPerWrite;

            // Create the coroutine here so we don't re-create over and over
            WaitForEndOfFrame lWaitForEndOfFrame = new WaitForEndOfFrame();

            // Clear the log each frame
            while (true)
            {
                // Wait until we reach the end of the frame and then flush the log. This way we can 
                // refresh the UI while in the frame.
                //
                // MEMORY: This causes 9/17 bytes of GC (runtime/editor)
                yield return lWaitForEndOfFrame;
                Log.Clear();
            }
        }
Пример #22
0
 static CoroutineEx()
 {
     CoroutineEx.waitForEndOfFrame    = new WaitForEndOfFrame();
     CoroutineEx.waitForFixedUpdate   = new WaitForFixedUpdate();
     CoroutineEx.waitForSecondsBuffer = new Dictionary <float, WaitForSeconds>();
 }
        private System.Collections.IEnumerator UpdateRoutine()
        {
            var waitForFixed = new WaitForFixedUpdate();
            var waitForLate = new WaitForEndOfFrame();

            Restart:

            switch(_useUpdateSequence)
            {
                case UpdateSequence.None:
                case UpdateSequence.Update:
                    yield return null;
                    break;
                case UpdateSequence.FixedUpdate:
                    yield return waitForFixed;
                    break;
                case UpdateSequence.LateUpdate:
                    yield return waitForLate;
                    break;
            }

            if (_useUpdateSequence != UpdateSequence.None && _stateMachine.Current != null)
            {
                _stateMachine.Current.UpdateMovement();
            }

            goto Restart;
        }
	protected override void Awake ()
	{
		Debug.Log("Match3BoardGameLogic Awake");
		instance = this;

		base.Awake ();
		
		waitEndFrame = new WaitForEndOfFrame();
			
		HOTween.Init(false, false, false);
		
		characterUsed = CharacterSpecialAnimations.characterIndex < 0 ? "" : CompanionSelect.icons[CharacterSpecialAnimations.characterIndex];
		
		LoadLevel(Match3BoardRenderer.levelIdx);
		
		// Once the level is loaded get the reference to the board data
		boardData = boardRenderer.GetComponent<BoardData>();
		
		gameSoundEventsHandler = new InGameSoundEventsHandler();
		gameSoundEventsHandler.RegisterSoundEvents();
	}
Пример #25
0
    IEnumerator FadeoutCoroutine(float time, System.Action action)
    {
        float endTime = Time.timeSinceLevelLoad + time * (cutoutRange);

        var endFrame = new WaitForEndOfFrame ();

        while (Time.timeSinceLevelLoad <= endTime) {
            cutoutRange = (endTime - Time.timeSinceLevelLoad) / time;
            fade.Range = cutoutRange;
            yield return endFrame;
        }
        cutoutRange = 0;
        fade.Range = cutoutRange;

        if (action != null) {
            action ();
        }
    }
Пример #26
0
 public IEnumerator PlayWait(int take)
 {
     WaitForEndOfFrame wait = new WaitForEndOfFrame();
     Play(take);
     while(isPlaying)
         yield return wait;
 }
Пример #27
0
        /// <summary>
        /// Called after the Awake() and before any update is called.
        /// </summary>
        public IEnumerator Start()
        {
            // Create the coroutine here so we don't re-create over and over
            WaitForEndOfFrame lWaitForEndOfFrame = new WaitForEndOfFrame();

            // Loop endlessly so we can process the timings at the end of each frame in
            // preperation for the next
            while (true)
            {
                yield return lWaitForEndOfFrame;
                TimeManager.Update();
            }
        }
        public static System.Collections.IEnumerator LateUpdateTickerIterator(System.Action a)
        {
            if (a == null) throw new System.ArgumentNullException("a");

            var wait = new WaitForEndOfFrame();
            yield return wait;
            while (true)
            {
                a();
                yield return wait;
            }
        }
Пример #29
0
	public Match3Globals() {
		waitEndFrame = new WaitForEndOfFrame();
		
		layerBoardTile = LayerMask.NameToLayer("BoardTile");
	}
        IEnumerator Start()
        {
            var path = EditorUtility.OpenFolderPanel ("Select target folder to screenshots", string.Empty, string.Empty);
            if (string.IsNullOrEmpty (path) || !Directory.Exists (path)) {
                FinishCapturing ("Invalid path");
                yield break;
            }

            var platform = EditorUserBuildSettings.activeBuildTarget.ToString ();
            var waiter = new WaitForEndOfFrame ();
            var savedPreset = GameViewResolution.GetPreset ();
            string err = null;
            int tempPreset;
            foreach (var res in _resList) {
                tempPreset = GameViewResolution.AddCustomPreset (res.x, res.y, "_capturer");
                GameViewResolution.SetPreset (tempPreset);
                yield return waiter;
                try {
                    Application.CaptureScreenshot (
                        Path.Combine (path, string.Format (FileNameMask, platform, res.x, res.y)));
                } catch (Exception ex) {
                    err = ex.ToString ();
                    break;
                }
                GameViewResolution.SetPreset (savedPreset);
                GameViewResolution.RemoveCustomPreset (tempPreset);
            }

            FinishCapturing (err);
        }
 protected IEnumerator waitCoroutine()
 {
     WaitForEndOfFrame endWaiter = new WaitForEndOfFrame();
       while (true) {
     yield return endWaiter;
     Int64 unityTime = (Int64)(Time.time * 1e6);
     clockCorrelator.UpdateRebaseEstimate(unityTime);
       }
 }
Пример #32
0
        /// <summary>
        /// Called after the Awake() and before any update is called.
        /// </summary>
        public IEnumerator Start()
        {
            // Force the xbox value
            InputManager.IsXboxControllerEnabled = _IsXboxControllerEnabled;
            InputManager.MoveActivator = _MoveActivator;
            InputManager.ViewActivator = _ViewActivator;

            // Create the coroutine here so we don't re-create over and over
            WaitForEndOfFrame lWaitForEndOfFrame = new WaitForEndOfFrame();

            // Loop endlessly so we can process the input
            // at the end of each frame, preparing for the next
            while (true)
            {
                yield return lWaitForEndOfFrame;
                InputManager.Update();
            }
        }
 /**
  * Coroutine that will call render on the native plugin at the end of every frame.
  */
 private IEnumerator RenderRemoteDisplayCoroutine()
 {
     var waitObject = new WaitForEndOfFrame();
       while (gameObject.activeInHierarchy && enabled) {
     yield return waitObject;
     MaybeRenderFrame();
       }
       yield return 0;
 }
Пример #34
0
 //    private InterstitialAd interstitial;
 void Start()
 {
     shI = GetComponent<ShareInfo>();
     shI.text = "Look, there's an amazing game! You can play it too!\n https://play.google.com/store/apps/details?id=com.azinecllc.flyingadventures";
     halfFadeTimeWFS = new WaitForSeconds(fadeTime / 2);
     fadeTimeWFS = new WaitForSeconds(fadeTime);
     wfeof = new WaitForEndOfFrame();
     levelEndWaitTimeWFS = new WaitForSeconds(levelEndWaitTime);
     pm = gameObject.GetComponent<ProgressManager>();
     anim = FadePlane.GetComponent<Animator>();
     anim.SetFloat("speedMultiplier", 1 / fadeTime);
     StartCoroutine(WaitForSplash());
     if (GameObject.FindGameObjectsWithTag(UI.tag).Length > 1)
     {
         Destroy(GameObject.FindGameObjectsWithTag(UI.tag)[1]);
     }
     if (GameObject.FindGameObjectsWithTag("es").Length > 1)
     {
         Destroy(GameObject.FindGameObjectsWithTag("es")[1]);
     }
     if (GameObject.FindGameObjectsWithTag(gameObject.tag).Length > 1)
     {
         Destroy(gameObject);
     }
 }