Ejemplo n.º 1
0
    private void UpdateVisibility()
    {
        float num;

        if (!this.MpSync)
        {
            num = (GreeblePlugin.GetCameraPosition() - base.transform.position).magnitude;
        }
        else
        {
            num = Scene.SceneTracker.GetClosestPlayerDistanceFromPos(base.transform.position);
        }
        float        num2  = 0f;
        GreebleShape shape = this.Shape;

        if (shape != GreebleShape.Sphere)
        {
            if (shape == GreebleShape.Box)
            {
                Vector2 vector = new Vector2(this.Size.x, this.Size.z);
                num2 = vector.magnitude;
            }
        }
        else
        {
            num2 = this.Radius;
        }
        float num3 = num - num2;
        bool  flag = num3 < this.ToggleDistance * TheForestQualitySettings.UserSettings.DrawDistanceGreebleRatio;

        if (flag != this.currentlyVisible)
        {
            if (flag)
            {
                this.Spawn();
            }
            else
            {
                this.Despawn();
            }
        }
    }
Ejemplo n.º 2
0
    public void ThreadedRefresh()
    {
        float num;

        if (!this.MpSync)
        {
            num = (GreeblePlugin.GetCameraPosition() - this.position).magnitude;
        }
        else
        {
            num = Scene.SceneTracker.GetClosestPlayerDistanceFromPos(this.position);
        }
        float        num2  = 0f;
        GreebleShape shape = this.Shape;

        if (shape != GreebleShape.Sphere)
        {
            if (shape == GreebleShape.Box)
            {
                Vector2 vector = new Vector2(this.Size.x, this.Size.z);
                num2 = vector.magnitude;
            }
        }
        else
        {
            num2 = this.Radius;
        }
        float num3 = num - num2;

        this.nextVisible = (num3 < this.ToggleDistance * TheForestQualitySettings.UserSettings.DrawDistanceGreebleRatio * ((!this.currentlyVisible) ? 1f : 1.1f));
        if (this.nextVisible != this.currentlyVisible)
        {
            this.ShouldDoMainThreadRefresh = true;
        }
        else if (this.ShouldDoMainThreadRefresh)
        {
            this.ShouldDoMainThreadRefresh = false;
        }
    }