private void Update() { HandleTouch(); if (Input.GetKeyDown(KeyCode.D)) { if (part != null && part.Selected) { selectedPart.SendMessage("Disassemble"); } else if (subPart != null && subPart.Selected) { selectedSubPart.SendMessage("Disassemble"); } } playSoundCooldown -= Time.deltaTime; }
private void HandleTouch() { if (Input.touchCount == 1) { HandleOneTouch(); } else if (Input.touchCount == 2 && !isSubPart) { HandleDualTouch(); } if (doubleTapCooldown >= 0) { doubleTapCooldown -= Time.deltaTime; } else { if (!isSubPart && toPlaySound) { if (part != null) { part.SendMessage("PlaySound"); } playSoundCooldown = playSoundRecoil; toPlaySound = false; } else if (isSubPart && toPlaySound) { if (subPart != null) { subPart.SendMessage("PlaySound"); } playSoundCooldown = playSoundRecoil; toPlaySound = false; } tapCount = 0; } }