void CheckIfTileTapped() { if (Input.GetMouseButtonDown(0)) { Vector3 touch = Input.mousePosition; Ray ray = Camera.main.ScreenPointToRay(touch); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000.0f)) { foreach (GameObject obj in tiles) { GroundTile tile = obj.GetComponent <GroundTile> (); if (hit.collider.gameObject == tile.gameObject) { tile.FadeStart(Time.time); tile.tapped = true; aTileIsTapped = true; // currDestination = tile.transform; // MovePlayer (); StartCoroutine(TapPowerDown(tile)); break; } } } } }
public void selectTile(GroundTile tile) { tile.FadeStart(Time.time); tile.tapped = true; aTileIsTapped = true; Debug.Break(); StartCoroutine(TapPowerDown(tile)); }