public int AddMat(Color color, float minHeight, Texture2D text = null, float tintStrength = 1.0f, float maxHeight = 0.0f, float minSlope = 0.0f, float maxSlope = 90.0f, float blendStrength = 0.1f, Vector2 tileOffset = default(Vector2), Vector2 tileScale = default(Vector2), Vector2 splatNoiseVScale = default(Vector2), float splatNoiseScaler = 0.1f) { // Setting all the parameters if they do not have a value if (maxHeight <= minHeight) { maxHeight = minHeight + 0.1f; } if (tileScale == default(Vector2)) { tileScale = new Vector2(50.0f, 50.0f); } if (splatNoiseVScale == default(Vector2)) { splatNoiseVScale = new Vector2(0.01f, 0.01f); } // Creating a new Material Level MaterialLevel newMat = new MaterialLevel(text, color, tintStrength, minHeight, maxHeight, minSlope, maxSlope, blendStrength, tileOffset, tileScale, splatNoiseVScale, splatNoiseScaler); // Looping through the list looking for its position for (int i = 0; i < NumMats; i++) { if (newMat.MinHeight < mats[i].MinHeight) { mats.Insert(i, newMat); return(i); } } // If this is the biggest height add to the end mats.Add(newMat); return(NumMats - 1); }
public int UpdateMatMaxHeight(int i, float maxHeight) { MaterialLevel newMat = mats[i]; if (newMat != null) { newMat.MaxHeight = maxHeight; } RemoveMat(i, true); return(AddMat(newMat)); }
public int UpdateMatMinHeight(int i, float minHeight) { // MaterialLevel newMat = new MaterialLevel(mats[index].Texture, mats[index].Tint, mats[index].TintStrength, minHeight, mats[index].MaxHeight, mats[index].MinSlope, mats[index].MaxSlope, mats[index].BlendStrength, mats[index].TileOffset, mats[index].TileScale, mats[index].SplatNoiseVScale, mats[index].SplatNoiseScaler); MaterialLevel newMat = mats[i]; if (newMat != null) { newMat.MinHeight = minHeight; } RemoveMat(i, true); return(AddMat(newMat)); }
public int AddMat(MaterialLevel newMat) { // If newmat is null return -1 if (newMat == null) { return(-1); } // Looping through the list looking for its position for (int i = 0; i < NumMats; i++) { if (newMat.MinHeight < mats[i].MinHeight) { mats.Insert(i, newMat); return(i); } } // If this is the biggest height add to the end mats.Add(newMat); return(NumMats - 1); }