예제 #1
0
    void innerStart()
    {
        int   hour = manager_.getSunManager().getHour();
        float r    = densities_[hour] * numPerHour_;

        nextOutTime_ = RandomEmitter.exponentialNextEncountTime(r, 1.0f) * 3600.0f;
    }
예제 #2
0
    void innerUpdate()
    {
        if (bFirstUpdate_ == true)
        {
            bFirstUpdate_ = false;
            innerStart();
        }
        int   hour    = manager_.getSunManager().getHour();
        float sec     = manager_.getSunManager().getElapsedSec();
        float elapsed = sec - preSec_;

        preSec_ = sec;

        // 経過時間に達していたら排出
        if (bValidateEmit_ == true)
        {
            nextOutTime_ -= elapsed;
            nextInterval_ = nextOutTime_;

            if (nextOutTime_ <= 0.0f)
            {
                if (emmitCallback_ != null)
                {
                    emmitCallback_();
                }
                float r = densities_[hour] * numPerHour_ * intensity_;
                if (r > 0.0f)
                {
                    nextOutTime_ = RandomEmitter.exponentialNextEncountTime(r, 1.0f) * 3600.0f;
                }
                else
                {
                    bValidateEmit_ = false;
                }
            }
            if (densities_[hour] > 0.0f)
            {
                bValidateEmit_ = true;
            }
        }
    }