Hello Tharanya,
in the simplest case you show/hide the components depending on the 'meter' condition. For example:
if ( meter == 1 )
{
Component1.Visible = true;
Component2.Visible = true;
Component3.Visible = true;
Component4.Visible = false;
Component5.Visible = false;
...
Component9.Visible = false;
}
if ( meter == 2 )
{
Component1.Visible = false;
Component2.Visible = false;
Component3.Visible = false;
Component4.Visible = true;
Component5.Visible = true;
Component6.Visible = true;
...
}
If you prefer the matrix, you can use a two dimensional array configured to store bool data. Fill the array appropriately with values. Then the above implementation could looks as shown below:
Component1.Visible = MatrixArray[ meter, 0 ];
Component2.Visible = MatrixArray[ meter, 1 ];
Component3.Visible = MatrixArray[ meter, 2 ];
...
Component9.Visible = MatrixArray[ meter, 8 ];
If you don't want all the component to exist the whole time, you can create them dynamically and remove them again if not needed anymore:
var YourUnit::Component1 comp1 = new YourUnit::Component1;
Add( comp1, 0 );
....
Remove( comp1 );
For more details see the section Compose the component programmatically
I hope it helps you further.
Best regards
Paul Banach