• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEngine.WaitForSeconds类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Awake

 private void Awake()
 {
     _startWait = new WaitForSeconds(Game.StartDelay);
     _endWait = new WaitForSeconds(Game.EndDelay);
     SpawnAllTanks();
     SetCameraTargets();
     StartCoroutine(GameLoop());
 }
开发者ID:BuriedStPatrick,项目名称:TanksGame,代码行数:8,代码来源:GameManager.cs


示例17: Update

	// Update is called once per frame
	void Update () {
        if (Input.GetKeyDown("g"))
        {
            Transform g = (Transform)Instantiate(amm, transform.position, transform.rotation);
            g.GetComponent<Rigidbody>().AddForce(transform.localPosition*speed);
            WaitForSeconds wait = new WaitForSeconds(1f);
        }
    }
开发者ID:kranzer,项目名称:My2DGAME,代码行数:9,代码来源:rig.cs


示例18: Awake

 override protected void Awake(){
     base.Awake();
     _animator = GetComponent<Animator>();
     _audioSources = GetComponentsInChildren<AudioSource>();
     _dieTimeWait = new WaitForSeconds(_deathClip.length + 5f);
     _capsuleCollider = GetComponent<CapsuleCollider>();
     _rigidbody = GetComponent<Rigidbody>();
     _damageTexture.enabled = false;
 }
开发者ID:EgoTeam,项目名称:Ego,代码行数:9,代码来源:Player.cs


示例19: checkRoutine

 IEnumerator checkRoutine()
 {
     WaitForSeconds wf = new WaitForSeconds(1);
     while (true)
     {
         checkFunctionality();
         yield return wf;
     }
 }
开发者ID:HiddenLayerOfRandomNumbers841,项目名称:Pfadsuche,代码行数:9,代码来源:customButtonAction.cs


示例20: Awake

 override protected void Awake () {
     Navigation              = GetComponent<NavMeshAgent>();
     _state                  = GetComponent<EnemyState>();
     _animator               = GetComponent<Animator>();
     _audioSources           = GetComponentsInChildren<AudioSource>();
     _dieTimeWait            = new WaitForSeconds(_deathClip.length + 5f);
     _capsuleCollider        = GetComponent<CapsuleCollider>();
     _rigidbody              = GetComponent<Rigidbody>();
 }
开发者ID:EgoTeam,项目名称:Ego,代码行数:9,代码来源:Enemy.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine.WebCamTexture类代码示例发布时间:2022-05-26
下一篇:
C# UnityEngine.WWWForm类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap