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); }
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; } }
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); }
private void Start() { this.Water.ProfilesManager.SetProfiles(WaterProfileBlend.CreateProfiles(this._Profiles, this._Weights)); }