当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine.WaitForSeconds类代码示例

本文整理汇总了C#中UnityEngine.WaitForSeconds的典型用法代码示例。如果您正苦于以下问题:C# WaitForSeconds类的具体用法?C# WaitForSeconds怎么用?C# WaitForSeconds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WaitForSeconds类属于UnityEngine命名空间,在下文中一共展示了WaitForSeconds类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        public IEnumerator Start()
        {
            pool = new InventoryPool<InventoryUIItemWrapper>(wrapperPrefab, 8);
            queue = new Queue<ItemHolder>(8);
            destroyTimer = new WaitForSeconds(slideAnimation.length - 0.025f);
            offsetTimer = new WaitForSeconds(offsetTimerSeconds);

            foreach (var inv in InventoryManager.GetLootToCollections())
            {
                inv.OnAddedItem += (items, amount, cameFromCollection) =>
                {
                    if (cameFromCollection == false)
                    {
                        queue.Enqueue(new ItemHolder() { item = items.FirstOrDefault(), stackSize = amount});
                    }
                };
            }

            while (true)
            {
                if (queue.Count > 0)
                {
                    ShowItem(queue.Peek().item, queue.Peek().stackSize);
                    queue.Dequeue(); // Remove it
                }

                yield return offsetTimer;
            }
        }
开发者ID:predominant,项目名称:Treasure_Chest,代码行数:29,代码来源:InventoriesItemReceiverUI.cs

示例2: Loop

	/// <summary>
	/// Loop the specified action periodically by the interval.
	/// </summary>
	/// <param name="action">Action.</param>
	/// <param name="interval">Interval.</param>
	IEnumerator Loop(Action action,float interval){
		WaitForSeconds waitForSeconds = new WaitForSeconds (interval);
		while (true) {
			action ();
			yield return waitForSeconds;//new WaitForSeconds (interval);
		}
	}
开发者ID:Star-Counters,项目名称:Star-Counters,代码行数:12,代码来源:GameMainLoop.cs

示例3: Start

 void Start()
 {
     delay = new WaitForSeconds(blinkSpeed);
     text = GetComponent<Text>();
     canvasGroup = GetComponent<CanvasGroup>();
     StartCoroutine(Blink());
 }
开发者ID:vekkna,项目名称:Prendeville-Memory,代码行数:7,代码来源:BlinkScript.cs

示例4: runTest

    private IEnumerator runTest()
    {
        var waiter = new WaitForSeconds( 1.0f );
        var targetPoint = Vector3.zero;
        var goKitLite = GoKitLite.instance;

        while( true )
        {
            for( var i = 0; i < _cubes.Length; i++ )
            {
                _timeX = _updateDelta * 0.15f;
                _timeY = _updateDelta * 0.3f;
                _timeZ = _updateDelta * 3.0f;

                targetPoint.x = _perlinNoiseGenerator.Noise( _timeX ) * 100 + _originalPositions[i].x;
                targetPoint.y = _perlinNoiseGenerator.Noise( _timeY ) * 100 + _originalPositions[i].y;
                targetPoint.z = _perlinNoiseGenerator.Noise( _timeZ ) * 100 + _originalPositions[i].z;

                goKitLite.positionTo( _cubes[i], 1.0f, targetPoint );

                _updateDelta += Time.deltaTime * 100;
            }

            yield return waiter;
        }
    }
开发者ID:rtlsilva,项目名称:GoKitLite,代码行数:26,代码来源:StressTestGUI.cs

示例5: Start

    private void Start()
    {
        m_StartWait = new WaitForSeconds(m_StartDelay);
        m_EndWait = new WaitForSeconds(m_EndDelay);

        StartCoroutine(GameLoop());
    }
开发者ID:kleberandrade,项目名称:more-rehab-system,代码行数:7,代码来源:GameManager.cs

示例6: runTest

    private IEnumerator runTest()
    {
        var waiter = new WaitForSeconds( 1.0f );

        while( true )
        {
            for( var i = 0; i < cubes.Length; i++ )
            {
                timex = updateChange * 0.1365143f;
                timey = updateChange * 0.3365143f;
                timez = updateChange * 2.5564f;

                endPt.x = noise.Noise( timex ) * (100+x) + origPos[i].x;
                endPt.y = noise.Noise( timey ) * (100+y) + origPos[i].y;
                endPt.z = noise.Noise( timez ) * (100+z) + origPos[i].z;

                var tween = tweens[i];
                props[i].resetWithNewEndValue( endPt );
                tween.restart( true );

                updateChange += Time.deltaTime *5;
            }

            yield return waiter;
        }
    }
开发者ID:Wikzo,项目名称:P6_CouchGaming,代码行数:26,代码来源:StressTestGUI.cs

示例7: DoFire

    IEnumerator DoFire() {
        WaitForSeconds fireW = new WaitForSeconds(fireWait);
        WaitForSeconds fireD = new WaitForSeconds(fireDelay);

        while((EntityState)state == EntityState.Normal) {
            yield return fireW;

            mFiring = true;

            rigidbody.velocity = Vector3.zero;

            fireSignalGO.SetActive(true);
            yield return fireD;
            fireSignalGO.SetActive(false);

            Vector3 pos = fireSignalGO.transform.position; pos.z = 0;
            Vector3 dir = Player.instance.collider.bounds.center - pos; dir.z = 0;
            dir.Normalize();

            Projectile proj = Projectile.Create(projGroup, fireProjType, pos, dir, null);
            proj.applyDirToUp.up = dir;

            mFiring = false;

            FollowChangePoint();
        }
    }
开发者ID:PushoN,项目名称:game-off-2013,代码行数:27,代码来源:EnemyFollowNShoot.cs

示例8: Awake

	void Awake()
	{
		Debug.Log("PossibleMatchesController awake");
		instance = this;
		
		waitPollTime = new WaitForSeconds(0.5f);
	}
开发者ID:JulyMars,项目名称:frozen_free_fall,代码行数:7,代码来源:PossibleMatchesController.cs

示例9: Start

        public void Start()
        {
            waitTime = new WaitForSeconds(shootInterval);
            damageHander = behaviorTree.GetVariable("Target") as SharedDamageHandler;

            StartCoroutine(Shoot());
        }
开发者ID:HaoYunSun,项目名称:TEMPORAIRE,代码行数:7,代码来源:Shooter.cs

示例10: Start

 void Start()
 {
     rb = GetComponent<Rigidbody2D>();
     audioSource = GetComponent<AudioSource>();
     if (rb != null) { hasRb = true; }
     audioCooldown = new WaitForSeconds(Random.Range(0.2f, 0.5f));
 }
开发者ID:TheBlackOrchid,项目名称:Platformer2D,代码行数:7,代码来源:ChainVolumeController.cs

示例11: Start

 private void Start()
 {
     m_Ball = FindObjectOfType<Ball>();
     m_StartWait = new WaitForSeconds(3.0f);
     m_EndWait = new WaitForSeconds(3.0f);
     StartCoroutine(GameLoop());
 }
开发者ID:kleberandrade,项目名称:pong,代码行数:7,代码来源:GameManager.cs

示例12: CauseDamageCoroutine

 public IEnumerator CauseDamageCoroutine(WaitForSeconds delay)
 {
     while (true) {
         CauseDamage();
         yield return delay;
        }
 }
开发者ID:AlexGrey,项目名称:Clicker,代码行数:7,代码来源:EnemyLogic.cs

示例13: Generate

    private IEnumerator Generate()
    {
        WaitForSeconds wait = new WaitForSeconds (1f);

        GetComponent<MeshFilter>().mesh = mesh = new Mesh ();
        mesh.name = "Procedural Grid";

        #region Vertices Creation
        totalVertices = (sizeX + 1) * (sizeY + 1);

        vertices = new Vector3[totalVertices];

        for (int i = 0, y = 0; y <= sizeY; y++) {
            for (int x = 0; x <= sizeX; x++, i++) {

                vertices[i] = new Vector3(x,y);

            }
        }

        mesh.vertices = vertices;
        #endregion

        int[] triangles = new int[6 * sizeX * sizeY];

        for (int ti = 0, vi = 0, y = 0; y < sizeY; y++, vi++) {
            for (int x = 0; x < sizeX; x++, ti += 6, vi++) {
                triangles [ti] = vi;
                triangles [ti+3] = triangles [ti+2] = vi+1;
                triangles [ti+4] = triangles [ti+1] = vi+sizeX + 1;
                triangles [ti+5] = vi+sizeX + 2;

                mesh.triangles = triangles;
                yield return wait;
            }
        }

        mesh.RecalculateNormals ();

        Vector2[] uv = new Vector2[vertices.Length];
        for (int i = 0, y = 0; y <= sizeY; y++) {
            for (int x = 0; x <= sizeX; x++, i++) {
                uv[i] = new Vector2((float)x / sizeX,  (float)y / sizeY);
            }
        }

        mesh.uv = uv;

        Vector4[] tangents = new Vector4[vertices.Length];
        Vector4 tangent = new Vector4 (1f, 0f, 0f, -1f);
        for (int i = 0, y = 0; y <= sizeY; y++) {
            for (int x = 0; x <= sizeX; x++, i++) {
                tangents[i] = tangent;
            }
        }
        mesh.tangents = tangents;

        mesh.MarkDynamic ();
    }
开发者ID:serginh023,项目名称:gameaiocean,代码行数:59,代码来源:ProceduralGrid.cs

示例14: Start

 void Start()
 {
     myTransform = transform;
     audio = GetComponent<AudioSource>();
     bulletLayer = gameObject.layer;
     shootRateWFS = new WaitForSeconds(shootRate);
     canShoot = true;
 }
开发者ID:TheBlackOrchid,项目名称:Platformer2D,代码行数:8,代码来源:MachineShooting.cs

示例15: Instructions

    public IEnumerator Instructions()
    {
        WaitForSeconds wait = new WaitForSeconds(2f);

        yield return wait;

        instructions.GetComponent<Animator>().SetBool("showing", false);
    }
开发者ID:the-cable-center,项目名称:tcc-photosphere-tour,代码行数:8,代码来源:IntroScriptVR.cs


注:本文中的UnityEngine.WaitForSeconds类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。