Quantcast
Channel: Answers for "If statement not working"
Viewing all articles
Browse latest Browse all 6

Answer by Uzquiano

$
0
0

Hi,

Obviously, because it is inside the 'switch(buildingType)' so if it goes always to any case the 'switch' statement is over because of the 'break'

It should be something like this

switch (buildingType) {
case (1) :
Instantiate (building1, position, transform.rotation);
position += Vector3 (0,0,zchange);
numberOfBuildings--;
break;

case (2) :
Instantiate (building2, position, transform.rotation);
position += Vector3 (0,0,zchange);
numberOfBuildings--;
break;

case (3) :
Instantiate (building3, position, transform.rotation);
position += Vector3 (0,0,zchange);
numberOfBuildings--;
break;

case (4) :
Instantiate (nothing, position, transform.rotation);
position += Vector3 (0,0,zchange);
numberOfBuildings--;
break;
}//end switch

if (numberOfBuildings == 0 && numberOfRows == 0){
print ("next");
position == Vector3 (10,0,0);
numberOfBuildings += inititalBuildingNumber;
rowchange += rowchangeIncrease;
numberOfRows--;
}

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>