Esempio n. 1
0
    private void Start()
    {
        particleSys = GetComponent <ParticleSystem>();

        if (particleArray == null || particleArray.Length < particleSys.maxParticles)
        {
            particleArray = new ParticleSystem.Particle[particleSys.maxParticles];
        }

        perfomanceOldSettings = Perfomance;
        UpdatePerfomanceSettings();
    }
Esempio n. 2
0
    private void Start()
    {
        particleSys = GetComponent <ParticleSystem>();
#if UNITY_5_5_OR_NEWER
        if (particleArray == null || particleArray.Length < particleSys.main.maxParticles)
        {
            particleArray = new ParticleSystem.Particle[particleSys.main.maxParticles];
        }
#else
        if (particleArray == null || particleArray.Length < particleSys.maxParticles)
        {
            particleArray = new ParticleSystem.Particle[particleSys.maxParticles];
        }
#endif
        perfomanceOldSettings = Perfomance;
        UpdatePerfomanceSettings();
    }
Esempio n. 3
0
    private void Init()
    {
        if (isInitilised)
        {
            return;
        }

        t           = transform;
        particleSys = GetComponent <ParticleSystem>();
        if (particleArray == null || particleArray.Length < particleSys.main.maxParticles)
        {
            particleArray = new ParticleSystem.Particle[particleSys.main.maxParticles];
        }

        perfomanceOldSettings = Perfomance;
        UpdatePerfomanceSettings();

        vSyncCount = QualitySettings.vSyncCount;

        isInitilised = true;
    }
Esempio n. 4
0
    private void Update()
    {
        if (!Application.isPlaying)
        {
            deltaTime    = Time.realtimeSinceStartup - lastStopTime;
            lastStopTime = Time.realtimeSinceStartup;
        }
        else
        {
            deltaTime = Time.deltaTime;
        }
        currentDelay += deltaTime;
        if (currentDelay < TimeDelay)
        {
            return;
        }
        if (!UseGlobalOffset)
        {
            currentOffset += OffsetSpeed * deltaTime;
        }
        else
        {
            if (Application.isPlaying)
            {
                currentOffset = OffsetSpeed * Time.time;
            }
            else
            {
                currentOffset = OffsetSpeed * Time.realtimeSinceStartup;
            }
        }
        if (Perfomance != perfomanceOldSettings)
        {
            perfomanceOldSettings = Perfomance;
            UpdatePerfomanceSettings();
        }
        time += deltaTime;

        if (QualitySettings.vSyncCount == 2)
        {
            UpdateTurbulence();
        }
        else if (QualitySettings.vSyncCount == 1)
        {
            if (Perfomance == PerfomanceEnum.Low)
            {
                if (skipFrame)
                {
                    UpdateTurbulence();
                }
                skipFrame = !skipFrame;
            }
            if (Perfomance == PerfomanceEnum.High)
            {
                UpdateTurbulence();
            }
        }
        else
        {
            if (QualitySettings.vSyncCount == 0)
            {
                if (time >= fpsTime)
                {
                    time = 0;
                    UpdateTurbulence();
                    deltaTimeLastUpdateOffset = 0;
                }
                else
                {
                    deltaTimeLastUpdateOffset += deltaTime;
                }
            }
        }
    }