示例#1
0
        private static List <float> NormalizeWeights(List <float> weights)
        {
            List <float> list = new List <float>(weights.Count);
            float        num  = WaterProfileBlend.WeightSum(weights);

            for (int i = 0; i < weights.Count; i++)
            {
                list.Add(weights[i] / num);
            }
            return(list);
        }
示例#2
0
 private void OnValidate()
 {
     if (Application.isPlaying && this.Water != null && this.Water.WindWaves != null)
     {
         this.Water.ProfilesManager.SetProfiles(WaterProfileBlend.CreateProfiles(this._Profiles, this._Weights));
     }
     if (WaterProfileBlend.WeightSum(this._Weights) == 0f)
     {
         this._Weights[0] = 1f;
     }
 }
示例#3
0
        private static Water.WeightedProfile[] CreateProfiles(List <WaterProfile> profiles, List <float> weights)
        {
            List <float> list  = WaterProfileBlend.NormalizeWeights(weights);
            int          count = profiles.Count;

            Water.WeightedProfile[] array = new Water.WeightedProfile[count];
            for (int i = 0; i < count; i++)
            {
                array[i] = new Water.WeightedProfile(profiles[i], list[i]);
            }
            return(array);
        }
示例#4
0
 private void Start()
 {
     this.Water.ProfilesManager.SetProfiles(WaterProfileBlend.CreateProfiles(this._Profiles, this._Weights));
 }