Hey guys,
I’m creating a game where a random number of tiles (1 - 3) are spawned and need to be touched simultaneously to progress.
I need help on how to determine whether all the tiles in the scene are being touched simultaneously.
Right now I have this script to deal with touch and there is a variable in another script that contains an integer value for the number of tiles spawned. I appreciate any help!
public class TouchController : MonoBehaviour {
void Update () {
for (var i = 0; i < Input.touchCount; ++i) {
if (Input.GetTouch (i).phase == TouchPhase.Stationary || Input.GetTouch(i).phase == TouchPhase.Began) {
Ray ray = Camera.main.ScreenPointToRay (Input.GetTouch (i).position);
RaycastHit hit;
if (Physics.Raycast(ray, out hit)) {
if (hit.transform.tag == "Tile") {
//if hit is tile do something
}
}
}
}
}
}