private void Update() { if (this.map == null) { return; } if (this.map.fow.textureBlendTime > 0f) { this.mBlendFactor = Mathf.Clamp01(this.mBlendFactor + Time.deltaTime / this.map.fow.textureBlendTime); } else { this.mBlendFactor = 1f; } if (this.mState == NJGFOW.State.Blending) { float time = Time.time; if (this.mNextUpdate < time) { this.mNextUpdate = time + this.map.fow.updateFrequency; this.mState = NJGFOW.State.NeedUpdate; } } else if (this.mState != NJGFOW.State.NeedUpdate) { this.UpdateTexture(); } }
private void UpdateTexture() { if (this.mState == NJGFOW.State.UpdateTexture0) { this.mTexture0.SetPixels32(this.mBuffer0); this.mTexture0.Apply(); this.mState = NJGFOW.State.UpdateTexture1; this.mBlendFactor = 0f; } else if (this.mState == NJGFOW.State.UpdateTexture1) { this.mState = NJGFOW.State.Blending; } }
private void ThreadUpdate() { Stopwatch stopwatch = new Stopwatch(); while (true) { if (this.mState == NJGFOW.State.NeedUpdate) { stopwatch.Reset(); stopwatch.Start(); this.UpdateBuffer(); stopwatch.Stop(); this.mState = NJGFOW.State.UpdateTexture0; } Thread.Sleep(1); } }