예제 #1
0
        public void Update()
        {
            UpdateFPS();

            if (Player.main != null && isShow)
            {
                timeCount += Time.deltaTime;

                if (timeCount > 1.0f)
                {
                    SubRoot playerSubRoot = Player.main.GetCurrentSub();

                    if (playerSubRoot != null)
                    {
                        temperature = playerSubRoot.GetInsideTemperature();
                    }
                    else if (WeatherManager.main != null && Player.main.transform.position.y > 0)
                    {
                        temperature = WeatherManager.main.GetCurrentOutdoorTemperature();
                    }
                    else if (WaterTemperatureSimulation.main != null)
                    {
                        temperature = WaterTemperatureSimulation.main.GetTemperature(Utils.GetLocalPlayerPos());
                    }

                    currentBiome = Player.main.GetBiomeString();
                    currentBatch = LargeWorldStreamer.main.GetContainingBatch(Utils.GetLocalPlayerPos());
                    isDay        = DayNightCycle.main.IsDay() ? 0 : 1;
                    day          = (int)DayNightCycle.main.GetDay();
                    timeCount    = 0.0f;
                }

                currentWorldPos = Player.main.transform.position;

                stringBuilder.Remove(0, stringBuilder.Length);

                stringBuilder.AppendFormat($"Biome: {currentBiome}" +
                                           $"   {string.Format("World Position: {0,3:N0}, {1,3:N0}, {2,3:N0}", currentWorldPos.x, currentWorldPos.y, currentWorldPos.z)}" +
                                           $"   Batch: {currentBatch}" +
                                           $"   Day: {day}" +
                                           $"   Time of Day: {daynightstr[isDay]}" +
                                           $"   Temp.: {Mathf.CeilToInt(temperature)} \u00B0C" +
                                           $"   Speed: {(int)speed} km/h" +
                                           $"   {string.Format("FPS: {0,3:N0}", FPS)}" +
                                           $"   {string.Format("MEM: {0,3:N0} MB (+{1,6:N2} MB/s)", totalmem, diffTotalmem)}" +
                                           $"   {string.Format("GC: {0,2:N0} ms (Total:{1,3})",  timeBetweenCollections, numCollections)}" +
                                           $"   Fixed Updates: {avgFixedUpdatesPerFrame}");

                infoText = stringBuilder.ToString();
            }
            else
            {
                timeCount = 0.0f;

                stringBuilder.Remove(0, stringBuilder.Length);

                stringBuilder.AppendFormat(
                    $"   {string.Format("FPS: {0,3:N0}", FPS)}" +
                    $"   {string.Format("MEM: {0,3:N0} MB (+{1,6:N2} MB/s)", totalmem, diffTotalmem)}" +
                    $"   {string.Format("GC: {0,2:N0} ms (Total:{1,3})", timeBetweenCollections, numCollections)}" +
                    $"   Fixed Updates: {avgFixedUpdatesPerFrame}");

                infoText = stringBuilder.ToString();
            }
        }