Ejemplo n.º 1
0
        public override void ReadDefaults(Season season)
        {
            base.ReadDefaults(season);

            SeasonsManager.WeatherManager.PrecipitationEvent.PrecipitationProfile profile = SeasonsManager.WeatherManager.sProfiles[Type] as SeasonsManager.WeatherManager.PrecipitationEvent.PrecipitationProfile;

            mTransitionTime.First  = profile.mMinTransitionTime[season];
            mTransitionTime.Second = profile.mMaxTransitionTime[season];

            mMinIntensityDuration = profile.mMinIntensityDuration[season];

            mIntensityWeights = new List <int>(3);

            for (int i = 0; i < 3; i++)
            {
                mIntensityWeights.Add((int)profile.mIntensityWeights[i][season]);
            }

            mIntensityChangeWeights = new List <int>(profile.mIntensityChangeWeights.Length);

            for (int i = 0; i < profile.mIntensityChangeWeights.Length; i++)
            {
                mIntensityChangeWeights.Add((int)profile.mIntensityChangeWeights[i][season]);
            }
        }
Ejemplo n.º 2
0
        public override void Apply(Season season)
        {
            base.Apply(season);

            SeasonsManager.WeatherManager.PrecipitationEvent.PrecipitationProfile profile = SeasonsManager.WeatherManager.sProfiles[Type] as SeasonsManager.WeatherManager.PrecipitationEvent.PrecipitationProfile;

            profile.mMinTransitionTime[season] = mTransitionTime.First;
            profile.mMaxTransitionTime[season] = mTransitionTime.Second;

            profile.mMinIntensityDuration[season] = mMinIntensityDuration;

            for (int i = 0; i < 3; i++)
            {
                profile.mIntensityWeights[i][season] = mIntensityWeights[i];
            }

            if (profile.mIntensityChangeWeights.Length < mIntensityChangeWeights.Count)
            {
                List <SeasonsManager.SeasonFloat> weights = new List <SeasonsManager.SeasonFloat>(profile.mIntensityChangeWeights);

                for (int i = weights.Count; i < mIntensityChangeWeights.Count; i++)
                {
                    weights.Add(new SeasonsManager.SeasonFloat());
                }

                profile.mIntensityChangeWeights = weights.ToArray();
            }

            for (int i = 0; i < mIntensityChangeWeights.Count; i++)
            {
                profile.mIntensityChangeWeights[i][season] = mIntensityChangeWeights[i];
            }

            // Zero out any remaining weights
            for (int i = mIntensityChangeWeights.Count; i < profile.mIntensityChangeWeights.Length; i++)
            {
                profile.mIntensityChangeWeights[i][season] = 0;
            }
        }