Skip to content

Instantly share code, notes, and snippets.

@amitkhare
Last active January 16, 2020 06:45
Show Gist options
  • Save amitkhare/1479293c52ad3d013ed9acf3888bf42a to your computer and use it in GitHub Desktop.
Save amitkhare/1479293c52ad3d013ed9acf3888bf42a to your computer and use it in GitHub Desktop.
Wasp3d
using System.Linq;
// ......................
// ......................
List<int> vals;
List<float> heights;
private void Calculate()
{
vals = new List<int>();
heights = new List<float>();
vals.Add(WInteger.HSeatVal_1);
vals.Add(WInteger.HSeatVal_2);
vals.Add(WInteger.HSeatVal_3);
vals.Add(WInteger.HSeatVal_4);
vals.Add(WInteger.CSeatVal_1);
vals.Add(WInteger.CSeatVal_2);
vals.Add(WInteger.CSeatVal_3);
vals.Add(WInteger.CSeatVal_4);
int MAX = vals.Max();
int MaxHeight = 440;
int MinHeight = 10;
// height = ( Value * MaxHeight / ValueMax ) + MinHeight
for(int i = 0; i < 8; i++){
heights.Add( (vals[i] * MaxHeight / MAX) + MinHeight );
}
WFloat.HBarHeight_1 = heights[0];
WFloat.HBarHeight_2 = heights[1];
WFloat.HBarHeight_3 = heights[2];
WFloat.HBarHeight_4 = heights[3];
WFloat.CBarHeight_1 = heights[4];
WFloat.CBarHeight_2 = heights[5];
WFloat.CBarHeight_3 = heights[6];
WFloat.CBarHeight_4 = heights[7];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment