void FingerGestures_OnFingerTap(int fingerIndex, Vector2 fingerPos, int tapCount) { // Debug.Log( "tapping"); if (!touchEnabled) { return; } CancelInvoke("noInteraction"); Invoke("noInteraction", BWConstants.idleTime); GameObject selection = PickObject(fingerPos); if (isSelectionFlower(selection)) { playSoundEffect("Bee_flowertap_new_01"); BWFlower flowerObj = selection.GetComponent <BWFlower>(); attempts++; if (flowerObj.getFlowerNumber() == numberToFind) { AGGameState.incrementStarCount(); CancelInvoke("noInteraction"); touchEnabled = false; flowerObj.setSelected(); beeToFlower(numberToFind); gameState = BWGameState.BWGameStateGuessed; //nextQuestion(); } else { flowerObj.setSelected(); playWrongSound(flowerObj.getFlowerNumber()); BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.playNoAnimation(); } } else { BWBee beeObj = bee.GetComponent <BWBee>(); if (selection == beeObj.body || selection == bubbleNumber) { voiceOverSource.clip = null; voiceOverSource.Stop(); currentClips = new List <AudioClip>(); playInstructionSound(); beeObj.playTapAnimation(); } } }
void FingerGestures_OnFingerTap(int fingerIndex, Vector2 fingerPos, int tapCount) { if (!touchEnabled) { return; } // Debug.Log( "tapping"); /* * GameObject selection = PickObject(fingerPos); * if(selection == null) return; * //Debug.Log(selection); * if(selection.name.StartsWith("Flower") || selection.name.StartsWith("Hive")) { * * }*/ GameObject selection = PickObject(fingerPos); if (selection == null) { return; } BWBee beeObj = bee.GetComponent <BWBee>(); CancelInvoke("noInteraction"); Invoke("noInteraction", BWConstants.idleTime); if (prevFlower != null) { CancelInvoke("deduceResult"); Invoke("deduceResult", 3.0f); } if (selection == beeObj.body || selection == bubbleNumber) { voiceOverSource.clip = null; voiceOverSource.Stop(); currentClips = new List <AudioClip>(); playInstructionSound(); beeObj.playTapAnimation(); playTutorialAnimation(); CancelInvoke("noInteraction"); Invoke("noInteraction", BWConstants.idleTime + 5.0f); if (prevFlower != null) { CancelInvoke("deduceResult"); Invoke("deduceResult", 8.0f); } } else { if (isSelectionFlower(selection)) { BWFlower flowerObj = selection.GetComponent <BWFlower>(); if (flowerObj.getFlowerNumber() == beeStartingPoint + numberToFind) { playHintSound(1); } else { playHintSound(-1); } } } }