コード例 #1
0
ファイル: TerrainControl.cs プロジェクト: sknchan/LegacyRust
 internal static void ter_flushtrees()
 {
     if (TerrainControl.activeTerrainControl && TerrainControl.activeTerrainControl._terrain)
     {
         TerrainHack.RefreshTreeTextures(TerrainControl.activeTerrainControl._terrain);
     }
 }
コード例 #2
0
ファイル: TerrainControl.cs プロジェクト: salvadj1/RustSource
 internal static void ter_flushtrees()
 {
     if ((activeTerrainControl != null) && (activeTerrainControl._terrain != null))
     {
         TerrainHack.RefreshTreeTextures(activeTerrainControl._terrain);
     }
 }
コード例 #3
0
ファイル: TerrainControl.cs プロジェクト: salvadj1/RustSource
    private void Update()
    {
        bool          flag;
        MountedCamera camera;
        float         idleinterval = terrain.idleinterval;

        if ((idleinterval <= 0f) || ((camera = MountedCamera.main) == null))
        {
            flag = true;
        }
        else
        {
            Vector3 vector3;
            Vector3 position = camera.transform.position;
            Vector3 forward  = camera.transform.forward;
            forward.Normalize();
            vector3.x = position.x - this.lastCameraPosition.x;
            vector3.y = position.y - this.lastCameraPosition.y;
            vector3.z = position.z - this.lastCameraPosition.z;
            float num2 = ((vector3.x * vector3.x) + (vector3.y * vector3.y)) + (vector3.z * vector3.z);
            if ((num2 > 5.625E-05f) || (Vector3.Angle(forward, this.lastCameraForward) > 0.5f))
            {
                this.lastCameraPosition = position;
                this.lastCameraForward  = forward;
                flag = true;
            }
            else
            {
                flag = false;
            }
        }
        float realtimeSinceStartup = Time.realtimeSinceStartup;

        if (flag)
        {
            this.timeNoticedCameraChange = realtimeSinceStartup;
        }
        else
        {
            float num4 = Time.realtimeSinceStartup - this.timeNoticedCameraChange;
            if (num4 > idleinterval)
            {
                this.timeNoticedCameraChange = (idleinterval <= 0f) ? realtimeSinceStartup : (realtimeSinceStartup - (num4 % idleinterval));
                TerrainHack.RefreshTreeTextures(this._terrain);
            }
        }
    }
コード例 #4
0
ファイル: TerrainControl.cs プロジェクト: sknchan/LegacyRust
    private void Update()
    {
        bool    flag;
        Vector3 vector3 = new Vector3();
        float   single;
        float   single1;
        float   single2;
        float   single3 = terrain.idleinterval;

        if (single3 > 0f)
        {
            MountedCamera mountedCamera  = MountedCamera.main;
            MountedCamera mountedCamera1 = mountedCamera;
            if (!mountedCamera)
            {
                flag   = true;
                single = Time.realtimeSinceStartup;
                if (!flag)
                {
                    single1 = Time.realtimeSinceStartup - this.timeNoticedCameraChange;
                    if (single1 > single3)
                    {
                        single2 = (single3 <= 0f ? single : single - single1 % single3);
                        this.timeNoticedCameraChange = single2;
                        TerrainHack.RefreshTreeTextures(this._terrain);
                    }
                }
                else
                {
                    this.timeNoticedCameraChange = single;
                }
                return;
            }
            Vector3 vector31 = mountedCamera1.transform.position;
            Vector3 vector32 = mountedCamera1.transform.forward;
            vector32.Normalize();
            vector3.x = vector31.x - this.lastCameraPosition.x;
            vector3.y = vector31.y - this.lastCameraPosition.y;
            vector3.z = vector31.z - this.lastCameraPosition.z;
            if ((vector3.x * vector3.x + vector3.y * vector3.y + vector3.z * vector3.z > 5.625E-05f ? false : Vector3.Angle(vector32, this.lastCameraForward) <= 0.5f))
            {
                flag   = false;
                single = Time.realtimeSinceStartup;
                if (!flag)
                {
                    single1 = Time.realtimeSinceStartup - this.timeNoticedCameraChange;
                    if (single1 > single3)
                    {
                        single2 = (single3 <= 0f ? single : single - single1 % single3);
                        this.timeNoticedCameraChange = single2;
                        TerrainHack.RefreshTreeTextures(this._terrain);
                    }
                }
                else
                {
                    this.timeNoticedCameraChange = single;
                }
                return;
            }
            else
            {
                this.lastCameraPosition = vector31;
                this.lastCameraForward  = vector32;
                flag   = true;
                single = Time.realtimeSinceStartup;
                if (!flag)
                {
                    single1 = Time.realtimeSinceStartup - this.timeNoticedCameraChange;
                    if (single1 > single3)
                    {
                        single2 = (single3 <= 0f ? single : single - single1 % single3);
                        this.timeNoticedCameraChange = single2;
                        TerrainHack.RefreshTreeTextures(this._terrain);
                    }
                }
                else
                {
                    this.timeNoticedCameraChange = single;
                }
                return;
            }
        }
        flag   = true;
        single = Time.realtimeSinceStartup;
        if (!flag)
        {
            single1 = Time.realtimeSinceStartup - this.timeNoticedCameraChange;
            if (single1 > single3)
            {
                single2 = (single3 <= 0f ? single : single - single1 % single3);
                this.timeNoticedCameraChange = single2;
                TerrainHack.RefreshTreeTextures(this._terrain);
            }
        }
        else
        {
            this.timeNoticedCameraChange = single;
        }
    }