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(); } } }
private void addTracingLine(GameObject preFlower, GameObject curFlower) { if (preFlower == null || curFlower == null) { return; } GameObject tracingLine = Instantiate(linePrefab) as GameObject; tracingLine.transform.parent = flowersLayer.transform; Vector3 pos = new Vector3(0, 0, 0); if (numberToFind > 0) { pos.x = preFlower.transform.localPosition.x + tracingLine.transform.localScale.x / 2.0f; pos.y = preFlower.transform.localPosition.y + 270; pos.z = 0; } else if (numberToFind < 0) { pos.x = curFlower.transform.localPosition.x + tracingLine.transform.localScale.x / 2.0f; pos.y = curFlower.transform.localPosition.y + 270; pos.z = 0; } else { DestroyObject(tracingLine); return; } tracingLine.transform.localPosition = pos; BWFlowersLayer layer = flowersLayer.GetComponent <BWFlowersLayer>(); layer.tracingLines.Add(tracingLine); BWFlower flowerObj = curFlower.GetComponent <BWFlower>(); flowerObj.setSelected(); }