You need to write your switch case properly. This code will not compile. The proper switch case syntac would be somethink like the one described here:
switch (touch.phase) {
case TouchPhase.Began:
samoKlik = true;
//if (samoKlik) { // This is not needed
StartCoroutine(korotinaKlika());
//}
break;
case TouchPhase.Moved:
isMoved = true;
if (!samoKlik) { // samoKlik does not exist here
if (jedan) {
break;
}
}
break;
case TouchPhase.Ended:
isMoved = false;
jedan = false;
break;
}
Since you want to fall from one conditional to another, it looks like the switch
statement is not right for you.
I would suggest to try the following:
- Declare your variables before your logic
bool samoKlik = false;
bool isMoved = false;
bool jedan = false;
- Start with if/else clauses.
I can identify one for you to help you going
if (touch.phase == touchPhase.Moved && !samoKlik && jedan)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…