dimanche 7 avril 2019

Better method then long if statements in unity c#

Im working on a game in which I have a canon that fires at difrent amounts of time. Instead of writing a long if statement like this:

If (time == 1) {
    "Do something "
} else If (time == 2) {
    "Do something else "
} else If (time == 3) {
   " You probaly get the point"
} else { 
   " My real problem is much longer than this. This is just. 
      an. 
    example"
}

So if there is an easier and prettier way to do this in c# that would be great. If not let me know also. Thanks in advance

Aucun commentaire:

Enregistrer un commentaire