コード例 #1
0
ファイル: SonarPool.cs プロジェクト: Huubertus14/Echo
    public void CreateSonar(Vector3 _pos, float lifeTime = 0, float startSpeed = 0)
    {
        if (!poolExist)
        {
            return;
        }

        ParticleBehaviour _part = pool.Dequeue();

        _part.gameObject.SetActive(true);
        _part.gameObject.transform.position = _pos;

        if (lifeTime > 0)
        {
            _part.SetLifeTime(lifeTime);
        }

        if (startSpeed > 0)
        {
            _part.SetStartSpeed(startSpeed);
        }

        _part.PlayParticle();

        pool.Enqueue(_part);
    }
コード例 #2
0
    private IEnumerator PingLoading()
    {
        float particleRate = 2.5f;
        float timer        = 0;

        partB.PlayParticle();
        while (true)
        {
            timer += Time.deltaTime;
            if (timer > particleRate)
            {
                timer = 0;
                partB.gameObject.transform.position = new Vector3(Random.Range(-125f, 125f), Random.Range(-125f, 125f), partB.transform.position.z);
                partB.PlayParticle();
            }
            yield return(0);
        }
    }
コード例 #3
0
    private void RPC_Ping(float beginSpeed = 0, float lifeTime = 0)
    {
        if (!isInitialized)
        {
            return;
        }

        if (beginSpeed == 0)
        {
            beginSpeed = baseSettings.basePingBeginSpeed;
        }
        if (lifeTime == 0)
        {
            lifeTime = baseSettings.basePingLifeTime;
        }

        pb.SetStartSpeed(beginSpeed);
        pb.SetLifeTime(lifeTime);

        pb.PlayParticle();
    }