public void resetCurrentQuestion() { touchEnabled = true; flowersLayer.transform.position = new Vector3(BWConstants.flowersLayerMinX, -350, -200); BWFlowersLayer layer = flowersLayer.GetComponent <BWFlowersLayer>(); layer.resetFlowersLayer(); if ((numberLineMax - numberLineMin) > BWConstants.numbersOnScreen) { enableScrolling = true; xvel = 0; lasty = 0; direction = BounceDirection.BounceDirectionStayingStill; } BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.flipBee(dataManager.shouldFlipBee); flowerLayerToInitialNumber(initialNumber); beeToFlower(beeStartingPoint); setExpectedNumbers(beeStartingPoint, numberToFind); }
private void beeToPosition(Vector3 pos) { BWBee beeObj = bee.GetComponent <BWBee>(); beeObj._delegate = this; beeObj.moveToPoint(pos); }
private void beeToFlower(int _flowerIndex) { if (flowersLayer == null) { return; } BWFlowersLayer layer = flowersLayer.GetComponent <BWFlowersLayer>(); GameObject flower = layer.flowerWithNumber(_flowerIndex); if (flower == null) { return; } Vector3 beePos = bee.transform.position; beePos.x = flower.transform.position.x; beePos.y = flower.transform.position.y + 320; BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.moveToPoint(beePos); // bee.transform.position = beePos; }
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(); } } }
public void deduceResult() { touchEnabled = false; attempts++; playWrongSound(0); BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.playNoAnimation(); prevFlower = null; CancelInvoke("noInteraction"); Invoke("noInteraction", BWConstants.idleTime + 5.0f); }
private void beeToSky() { BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.flipBee(dataManager.shouldFlipBee); if (dataManager.shouldFlipBee) { beeToPosition(new Vector3(450, 200, -150)); } else { beeToPosition(new Vector3(-450, 200, -150)); } }
public void beeMoveFinished() { if (gameState == BWGameState.BWGameStateGuessed) { BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.playYesAnimation(); if (dataManager.calculateResult(attempts, 1)) { beeObj.shouldPlayCelebration = true; dataManager.fetchLevelData(); } playSucess(); BWFlowersLayer layerObj = flowersLayer.GetComponent <BWFlowersLayer>(); GameObject flower = layerObj.flowerWithNumber(numberToFind); BWFlower flowerObj = flower.GetComponent <BWFlower>(); flowerObj.setPollinated(); } }
public void nextQuestion() { enableScrolling = false; isDragging = false; isSwiping = false; prevFlower = null; if (attempts > 0) { } attempts = 0; dataManager.fetchNextQuestionData(); numberLineMin = dataManager.numberLineMin; numberLineMax = dataManager.numberLineMax; initialNumber = dataManager.initialNumber; numberToFind = dataManager.numberToFind; beeStartingPoint = dataManager.beeStartingIndex; string numberimg = string.Format("BW_NumberLine/Sprites/Referent/Referant_numbers{0}", AGGameState.modInt(numberToFind)); bubbleNumber.renderer.material.mainTexture = (Texture2D)Resources.Load(numberimg); if (numberToFind < 0) { bubbleSymbol.renderer.material.mainTexture = (Texture2D)Resources.Load("BW_NumberLine/Sprites/Referent/Referant_exporterminus"); } else { bubbleSymbol.renderer.material.mainTexture = (Texture2D)Resources.Load("BW_NumberLine/Sprites/Referent/Referant_exporterPlus"); } flowersLayer.transform.position = new Vector3(BWConstants.flowersLayerMinX, -350, -200); BWFlowersLayer layer = flowersLayer.GetComponent <BWFlowersLayer>(); layer.setDiagonalFlowersLayer(numberLineMin, numberLineMax, initialNumber); if ((numberLineMax - numberLineMin) > BWConstants.numbersOnScreen) { enableScrolling = true; xvel = 0; lasty = 0; direction = BounceDirection.BounceDirectionStayingStill; } BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.flipBee(dataManager.shouldFlipBee); flowerLayerToInitialNumber(initialNumber); beeToFlower(beeStartingPoint); setExpectedNumbers(beeStartingPoint, numberToFind); if (dataManager.currentLevel == 0) { Invoke("levelZeroTutorial", 3); } else { playInstructionSound(); } CancelInvoke("noInteraction"); Invoke("noInteraction", BWConstants.idleTime + 5.0f); touchEnabled = true; }
void FingerGestures_OnFingerDragEnd(int fingerIndex, Vector2 fingerPos) { if (!touchEnabled) { return; } CancelInvoke("noInteraction"); Invoke("noInteraction", BWConstants.idleTime); if (fingerIndex == dragFingerIndex) { dragFingerIndex = -1; isDragging = false; if (isSwiping) { //Swiping isSwiping = false; GameObject selection = PickObject(fingerPos); if (selection != null && (selection.name.StartsWith("Flower") || selection.name.StartsWith("Hive"))) { BWFlower flowerObj = selection.GetComponent <BWFlower>(); if (expectedNumbers.Count > 0 && flowerObj.getFlowerNumber() == (int)expectedNumbers[0] && swipingWentOut) { beeToFlower((int)expectedNumbers[0]); expectedNumbers.RemoveAt(0); addTracingLine(prevFlower, selection); prevFlower = selection; } else if (expectedNumbers.Count == 0 && swipingWentOut) { incorrectSwipingBeyondTarget(prevFlower, selection); } } } if (expectedNumbers.Count == 0) { if (currentAnswer == true) { prevFlower = null; CancelInvoke("noInteraction"); AGGameState.incrementStarCount(); attempts++; playSucess(); BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.playYesAnimation(); if (dataManager.calculateResult(attempts, 1)) { beeObj.shouldPlayCelebration = true; dataManager.fetchLevelData(); } touchEnabled = false; BWFlowersLayer layerObj = flowersLayer.GetComponent <BWFlowersLayer>(); GameObject flower = layerObj.flowerWithNumber(beeStartingPoint + numberToFind); BWFlower flowerObj = flower.GetComponent <BWFlower>(); flowerObj.setPollinated(); } else { touchEnabled = false; attempts++; playWrongSound(0); BWBee beeObj = bee.GetComponent <BWBee>(); beeObj.playNoAnimation(); prevFlower = null; CancelInvoke("noInteraction"); Invoke("noInteraction", BWConstants.idleTime + 5.0f); } } else { if (prevFlower != null) { BWFlower flowerObj = prevFlower.GetComponent <BWFlower>(); int newStarting = flowerObj.getFlowerNumber(); setExpectedNumbers(newStarting, numberToFind - (newStarting - beeStartingPoint)); } } } if (prevFlower != null) { CancelInvoke("deduceResult"); Invoke("deduceResult", 3.0f); } }
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); } } } }