void UpdateAttachedObjectsVisibility()
{
foreach( MapObjectAttachedObject attachedObject in AttachedObjects )
{
//lessHalfLife
if( attachedObject.Alias == "lessHalfLife" )
{
attachedObject.Visible = ( Life < Type.LifeMax * .5f && buildedProgress == 1 );
continue;
}
//lessQuarterLife
if( attachedObject.Alias == "lessQuarterLife" )
{
attachedObject.Visible = ( Life < Type.LifeMax * .25f && buildedProgress == 1 );
continue;
}
//productUnit
if( attachedObject.Alias == "productUnit" )
{
attachedObject.Visible = productUnitType != null;
continue;
}
//building
{
string showAlias = null;
if( buildedProgress < .25f )
showAlias = "building0";
else if( buildedProgress < .5f )
showAlias = "building1";
else if( buildedProgress < 1 )
showAlias = "building2";
if( showAlias != null )
attachedObject.Visible = ( attachedObject.Alias == showAlias );
else
attachedObject.Visible = !attachedObject.Alias.Contains( "building" );
}
}
}