コード例 #1
0
        private void UpdateSeason()
        {
            WeatherMakerScript.AssertExists();
            int month = WeatherMakerScript.Instance.DayNightScript.Month - 1;

            if (month < 0 || month > 11)
            {
                return;
            }
            float season;

            if (WeatherMakerScript.Instance.DayNightScript.Latitude > 0.0f)
            {
                season = monthToSeasonLookupNorth[month];
            }
            else
            {
                season = monthToSeasonLookupSouth[month];
            }
            if (season != lastSeason)
            {
                lastSeason = season;
                OnUpdateSeason(season);
            }
        }
コード例 #2
0
 private void LateUpdate()
 {
     WeatherMakerScript.AssertExists();
     if (IsServer)
     {
         RpcSetTimeOfDay(WeatherMakerScript.Instance.DayNightScript.TimeOfDay);
     }
     else
     {
         // disable day night speed, the server will be syncing the day / night
         WeatherMakerScript.Instance.DayNightScript.Speed = WeatherMakerScript.Instance.DayNightScript.NightSpeed = 0.0f;
     }
 }
コード例 #3
0
        public override void Initialize()
        {
            base.Initialize();

            CanPlay = true;

#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return;
            }
#endif

            if (AudioSourceLoop == null && WeatherMakerScript.Instance != null)
            {
                WeatherMakerScript.AssertExists();
                AudioSource source = WeatherMakerScript.Instance.gameObject.AddComponent <AudioSource>();
                source.loop        = Looping;
                source.playOnAwake = false;
                source.hideFlags   = HideFlags.HideAndDontSave | HideFlags.HideInInspector;
                AudioSourceLoop    = new WeatherMakerLoopingAudioSource(source, 0.0f, 0.0f, Looping);
            }
        }