void updateChild() { Texture2D _childTexture = new Texture2D(1024, 768); byte [] data = AGGameState.getChildImage(); if (data != null && data.Length > 0) { _childTexture.LoadImage(data); } else { _childTexture = defaultChildImage; } childImage.renderer.material.mainTexture = _childTexture; starCount.text = string.Format("{0}", AGGameState.getStarCount()); string chName = AGGameState.getChildName(); if (chName == null || chName.Equals("")) { chName = "Child"; } childName.text = chName; }
private void playIdleSound() { if (isPlayingSuccessSound) { return; } currentClips = new List <AudioClip>(); int _num = AGGameState.modInt(numberToFind); string numer = string.Format("number_{0}", _num); AudioClip numerClip = loadSound(numer); int rand = UnityEngine.Random.Range(0, 2); if (rand == 0 || numberToFind == 0) { currentClips.Add(loadSound("flowers_intro_4")); } else { currentClips.Add(loadSound("flowers_find_todo_1_a")); if (numberToFind < 0) { currentClips.Add(loadSound("word_negative")); } currentClips.Add(numerClip); } }
public void loadLevelOrQuestion() { questionPlayed++; isUserPlayedTheQuestion = true; totalWrongAttempts = 0; loadingQuestionOrLevelInProgress = true; Debug.Log("Total Attempts: " + totalAttempts + " Total Corrects: " + totalCorrects); bool isleveldone = false; if (totalAttempts > 0) { isleveldone = pgDataManager.calculateResult(totalAttempts, totalCorrects); } if (questionPlayed >= 5) { AGGameState.loadNextGameInLoop(AGGameIndex.k_ShapePond); // to play in loop return; } if (isleveldone) // Check result { StartCoroutine(ResetLevel(0.5F, nextLevelDecision.loadLevel)); // load new level } else { StartCoroutine(ResetLevel(0.5F, nextLevelDecision.loadQuestion)); // load next question } }
void playNumberSound(int _number) { if (numberToFind > 0 && dataManager.currentLevel >= 9 && dataManager.currentLevel <= 16) { _number = _number + beeStartingPoint; } if (numberToFind < 0 && dataManager.currentLevel >= 1 && dataManager.currentLevel <= 12) { _number = _number + beeStartingPoint; } voiceOverSource.clip = null; voiceOverSource.Stop(); currentClips = new List <AudioClip>(); if (_number < 0) { currentClips.Add(loadSound("word_negative")); } currentClips.Add(loadSound(string.Format("number_{0}", AGGameState.modInt(_number)))); playAudioList(currentClips); }
private void playSucess() { if (isPlayingSuccessSound) { return; } voiceOverSource.clip = null; voiceOverSource.Stop(); currentClips = new List <AudioClip>(); int _num2 = AGGameState.modInt(numberToFind + dataManager.beeStartingIndex); AudioClip number2 = loadSound(string.Format("number_{0}", _num2)); currentClips.Add(loadSound("flowers_praise_2_f")); if (numberToFind + dataManager.beeStartingIndex < 0) { currentClips.Add(loadSound("word_negative")); } currentClips.Add(number2); isPlayingSuccessSound = true; playSoundEffect("Bee_positive_new_01cut"); playAudioList(currentClips); }
private void playHintSound(int _hint) { voiceOverSource.clip = null; voiceOverSource.Stop(); currentClips = new List <AudioClip>(); if (_hint == -1) { int _num1 = AGGameState.modInt(numberToFind); string numer1 = string.Format("number_{0}", _num1); AudioClip numerClip1 = loadSound(numer1); if (_num1 > 1) { currentClips.Add(loadSound("flowers_counting_todo_3_a")); currentClips.Add(numerClip1); currentClips.Add(loadSound("flowers_counting_todo_3_b")); } else { currentClips.Add(loadSound("flowers_counting_todo_4")); } } else { AudioClip hint = loadSound(string.Format("flowers_hint_{0}", _hint)); currentClips.Add(hint); } playAudioList(currentClips); }
void Start() { FingerGestures.OnFingerTap += FingerGestures_OnFingerTap; bool noError; noError = PListManager.ParsePListFile(gameData.text, ref gameDataTable); if (noError) { allPositions = (Hashtable)gameDataTable["positions"]; availableAnimals = (ArrayList)gameDataTable["availableAnimals"]; } else { //next game AGGameState.loadNextGameInLoop(AGGameIndex.k_MemoryAnimal); } dataManager = new MADataManager(AGGameIndex.k_MemoryAnimal, 0, progression.text); ickyAnimations = ickyModel.GetComponent <MAIckyAnimations>(); nextQuestion(); }
void FingerGestures_OnFingerTap(int fingerIndex, Vector2 fingerPos, int tapCount) { GameObject selection = PickObject(fingerPos); //Debug.Log(selection.name); if (selection == null) { return; } if (selection.name.StartsWith("Icon1")) { AGGameState.startGame(AGGameIndex.k_FishWorld_HideNSeek); } if (selection.name.StartsWith("Icon2")) { showAlertWithImage("unlockpopup_objectbasedmath"); } if (selection.name.StartsWith("Icon3")) { showAlertWithImage("unlockpopup_countingupto10"); } if (selection.name.StartsWith("Icon4")) { showAlertWithImage("unlockpopup_senseofquantity"); } }
private void playSucess() { if (isPlayingSuccessSound) { return; } currentClips = new List <AudioClip>(); int _num = AGGameState.modInt(numberToFind); string numer = string.Format("number_{0}", _num); AudioClip numerClip = loadSound(numer); int rand = Random.Range(0, 2); string o_number = null; if (numberToFind > 0 && numberToFind <= 10) { o_number = string.Format("o_number_{0}", _num); } else { o_number = string.Format("number_{0}", _num); } AudioClip o_numerClip = loadSound(o_number); if (rand == 0 || numberToFind < 0) { currentClips.Add(loadSound("all_find_1")); if (numberToFind < 0) { currentClips.Add(loadSound("word_negative")); } currentClips.Add(numerClip); } else { currentClips.Add(loadSound("ordinal_number_correct_1_a")); currentClips.Add(o_numerClip); currentClips.Add(loadSound("flowers_find_todo_1_b")); } if (numberToFind == 0) { currentClips = new List <AudioClip>(); currentClips.Add(loadSound("all_find_1")); currentClips.Add(numerClip); } isPlayingSuccessSound = true; playSoundEffect("Bee_positive_new_01cut"); playAudioList(currentClips); }
public void saveManager() { AndroidJavaObject persistanceManager = AGGameState.getPersistanceManager(); if (persistanceManager != null) { persistanceManager.Call("saveResult", result); } }
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 OnGUI() { * * if(customSkin != null) { * GUI.skin = customSkin; * } * * float offset = Screen.currentResolution.width / 1280.0f; * * if (GUI.Button(new Rect(0, 0, 170 * offset, 170 * offset), worldButton)){ * Application.LoadLevel(0); * } * * if(GUI.Button(new Rect(Screen.currentResolution.width - 170 * offset, 0, 170 * offset, 170 * offset), homeButton)) { * Application.LoadLevel(2); * } * } */ void Update() { //back button if (Application.platform == RuntimePlatform.Android) { if (Input.GetKey(KeyCode.Escape)) { AGGameState.gotoHomeScreen(); } } }
public void moveToPoint(Vector3 destination) { //Debug.Log("") iTween.Stop(bee); if (destination.x == transform.position.x && destination.y == transform.position.y) { moveToPointComplete(); } if (destination.x < transform.position.x) { Vector3 beeScale = bee.transform.localScale; beeScale.x = -1; bee.transform.localScale = beeScale; bee.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 15)); } else { Vector3 beeScale = bee.transform.localScale; beeScale.x = 1; bee.transform.localScale = beeScale; bee.transform.rotation = Quaternion.Euler(new Vector3(0, 0, -15)); } List <Vector3> points = new List <Vector3>(); points.Add(transform.position); points.Add(new Vector3(transform.position.x, transform.position.y + 100, transform.position.z)); points.Add(new Vector3(destination.x, transform.position.y + 100, transform.position.z)); points.Add(new Vector3(destination.x, destination.y, transform.position.z)); BezierPath bezierPath = new BezierPath(); // bezierPath.Interpolate(points, .25f); bezierPath.SetControlPoints(points); List <Vector3> drawingPoints = bezierPath.GetDrawingPoints2(); Vector3[] path = new Vector3[drawingPoints.Count]; for (int i = 0; i < drawingPoints.Count; i++) { path[i] = drawingPoints[i]; } float distance = AGGameState.modFloat(destination.x - transform.position.x); float speed = 1000.0f; float time = distance / speed; iTween.MoveTo(gameObject, iTween.Hash("path", path, "time", time, "onComplete", "moveToPointComplete", "easetype", iTween.EaseType.linear)); }
void FingerGestures_OnFingerTap(int fingerIndex, Vector2 fingerPos, int tapCount) { GameObject selection = PickObject(fingerPos); if (selection == null) { return; } if (bwButton != null && selection.name.Equals(bwButton.name)) { AGGameState.switchWorlds(AGWorldIndex.k_BeeWorld); } if (jwButton != null && selection.name.Equals(jwButton.name)) { AGGameState.switchWorlds(AGWorldIndex.k_JungleWorld); } if (fwButton != null && selection.name.Equals(fwButton.name)) { AGGameState.switchWorlds(AGWorldIndex.k_FishWorld); } if (iwButton != null && selection.name.Equals(iwButton.name)) { AGGameState.switchWorlds(AGWorldIndex.k_IckyWorld); } if (swButton != null && selection.name.Equals(swButton.name)) { AGGameState.switchWorlds(AGWorldIndex.k_ShapeWorld); } if (cwButton != null && selection.name.Equals(cwButton.name)) { AGGameState.switchWorlds(AGWorldIndex.k_CircusWorld); } if (tvButton != null && selection.name.Equals(tvButton.name)) { AGGameState.switchWorlds(AGWorldIndex.k_VideoWorld); } if (childSwitchButton != null && selection.name.Equals(childSwitchButton.name)) { Debug.Log("switching child"); AGGameState.switchChild(); } }
public void flowerLayerDestroyed() { questionsInSession++; if (questionsInSession >= 5) { AGGameState.loadNextGameInLoop(AGGameIndex.k_Beeworld_NumberSequence); return; } else { nextQuestion(); } }
void FingerGestures_OnFingerLongPress(int fingerIndex, Vector2 fingerPos) { GameObject selection = PickObject(fingerPos); if (selection == null) { return; } if (homeButton != null && selection.name.Equals(homeButton.name)) { Debug.Log(selection); AGGameState.gotoDashboard(); } }
void FingerGestures_OnFingerTap(int fingerIndex, Vector2 fingerPos, int tapCount) { GameObject selection = PickObject(fingerPos); //Debug.Log(selection.name); if (selection == null) { return; } if (selection.name.StartsWith("Icon")) { BeeWorldMenuIcon icon = selection.GetComponent <BeeWorldMenuIcon>(); AGGameState.startGame(icon.gameIndex); } }
void celebrationAnimationFinished() { if (questionsPlayed >= 5) { AGGameState.loadNextGameInLoop(AGGameIndex.k_MemoryAnimal); } else { questionsPlayed++; if (dataManager.calculateResult(attempts, corrects)) { dataManager.fetchLevelData(); } nextQuestion(); } }
void updateChild() { Texture2D _childTexture = new Texture2D(1024, 768); byte [] data = AGGameState.getChildImage(); if (data != null && data.Length > 0) { _childTexture.LoadImage(data); } else { _childTexture = defaultChildImage; } childImage.renderer.material.mainTexture = _childTexture; starCount.text = string.Format("{0}", AGGameState.getStarCount()); string chName = AGGameState.getChildName(); if (chName != null && !chName.Equals(childName.text)) { double timeSpent = (double)(Time.time - AGGameState.startingTime); AndroidJavaObject persistanceManager = AGGameState.getPersistanceManager(); persistanceManager.Call("addChildSessionTimeLog", (double)timeSpent); AGGameState.startingTime = Time.time; } if (chName == null || chName.Equals("")) { chName = "Child"; } childName.text = chName; if (AGGameState.getChildCount() > 1) { childSwitchButton.SetActive(true); } else { childSwitchButton.SetActive(false); } }
void FingerGestures_OnFingerTap(int fingerIndex, Vector2 fingerPos, int tapCount) { GameObject selection = PickObject(fingerPos); if (selection == null) { return; } if (homeButton != null && selection.name.Equals(homeButton.name)) { AGGameState.gotoHomeScreen(); } if (worldButton != null && selection.name.Equals(worldButton.name)) { AGGameState.switchWorlds(currentWorldIndex); } }
public void flowerLayerDestroyed() { /*if(currentCategoryIndex == 0) * currentCategoryIndex = 1; * else if(currentCategoryIndex == 1) * currentCategoryIndex = 0; */ //dataManager.saveData(); //dataManager = new BWDataManager(AGGameIndex.k_Beeworld_CoutingUpDown, currentCategoryIndex, progression.text); questionsInSession++; if (questionsInSession >= 5) { AGGameState.loadNextGameInLoop(AGGameIndex.k_Beeworld_CoutingUpDown); } else { nextQuestion(); } }
public void correctGuess() { foreach (GameObject anim in tempSelections) { animals.Remove(anim); Destroy(anim); } if (animals.Count == 0) { AGGameState.incrementStarCount(); ickyAnimations.animState = MAIckyAnimationState.celebration; Invoke("celebrationAnimationFinished", 53F / 30F); return; } isTouchEnabled = true; currentSelection = null; tempSelections = null; }
void playWrongSound(int wNumber) { voiceOverSource.clip = null; voiceOverSource.Stop(); int _num = AGGameState.modInt(wNumber); string numer = string.Format("number_{0}", _num); AudioClip numberClip = loadSound(numer); currentClips = new List <AudioClip>(); currentClips.Add(loadSound("all_wrong_5_a")); if (wNumber < 0) { currentClips.Add(loadSound("word_negative.mp3")); } currentClips.Add(numberClip); playSoundEffect("Bee_negative_new_01cut"); playAudioList(currentClips); }
public static void addDummyCategoryData() { int [] categoryIDs = { 169, 178, 179, 180, 51, 132, 32, 131 }; for (int i = 0; i < categoryIDs.Length; i++) { CoreDataManager coreManager = new CoreDataManager(categoryIDs[i]); Hashtable allCategoriesCoreData = coreManager.getResultDict(); foreach (string key in allCategoriesCoreData.Keys) { Hashtable objDict = (Hashtable)allCategoriesCoreData[key]; int attempted = AGGameState.GetAsInt(objDict["attempted"]); int solved = AGGameState.GetAsInt(objDict["solved"]); objDict["attempted"] = attempted + UnityEngine.Random.Range(10, 13); objDict["solved"] = solved + UnityEngine.Random.Range(6, 10); } coreManager.setResultDict(allCategoriesCoreData); coreManager.saveManager(); } }
public CoreDataManager(int skillId) { skillID = skillId; AndroidJavaObject persistanceManager = AGGameState.getPersistanceManager(); if (persistanceManager != null) { result = persistanceManager.Call <AndroidJavaObject>("getResultForCategoryId", skillID); currentLevel = result.Call <int>("getCurrentLevel"); totalLevels = result.Call <int>("getTotalLevels"); categoryStatus = result.Call <int>("getCategoryStatus"); string dict = result.Call <string>("getResultDataDic"); AGGameState.setChild(persistanceManager.Call <AndroidJavaObject>("getCurrentChild")); if (dict != null) { resultDict = MiniJSON.jsonDecode(dict) as Hashtable; } } }
private int beeStartingPointFromString(string startingPosition, string condition) { int defaultNumber = numberLineMin; if (currentCategoryID.Equals("180")) { defaultNumber = numberLineMax; } int number = defaultNumber; string [] posArray = startingPosition.Split(new char [] { ',' }); if (posArray.Length == 0) { number = initialNumber; } else if (posArray.Length == 1) { number = System.Convert.ToInt32(posArray[0]); } else if (posArray.Length == 2) { number = (int)Random.Range(System.Convert.ToInt32(posArray[0]), System.Convert.ToInt32(posArray[1]) + 1); } else { int index = totalQuestions % posArray.Length; number = System.Convert.ToInt32(posArray[index]); } BWNumberSequence sequence = getNumberSequenceFromString(condition); if (sequence == BWNumberSequence.BWNumberSequenceNumberAsked) { if (number < 0) { number = -numberToFind; } else { number = AGGameState.modInt(numberToFind); } } if (number + numberToFind > numberLineMax) { number = anySmallerNumberAvailable(number); if (number + numberToFind > numberLineMax) { number = numberLineMax - numberToFind; } else { numberToFind = number; } } else if (number + numberToFind < numberLineMin) { number = anyGreaterNumberAvailable(number); if (number + numberToFind < numberLineMin) { number = numberLineMin - numberToFind; } else { numberToFind = number; } } return(number); }
void playInstructionSound() { string number = null; int _number = AGGameState.modInt(numberToFind); AudioClip numberClip = loadSound(string.Format("number_{0}", _number)); AudioClip o_numberClip; if (_number > 0 && _number <= 10) { o_numberClip = loadSound(string.Format("o_number_{0}", _number)); } else { o_numberClip = loadSound(string.Format("number_{0}", _number)); } if (numberToFind < 0) { int rand = Random.Range(0, 4); if (rand == 0) { currentClips.Add(loadSound("flowers_find_todo_1_a")); currentClips.Add(loadSound("word_negative")); currentClips.Add(numberClip); } else if (rand == 1) { currentClips.Add(loadSound("flowers_find_todo_1_a")); currentClips.Add(loadSound("word_negative")); currentClips.Add(numberClip); } else if (rand == 2) { currentClips.Add(loadSound("flowers_find_todo_2_a")); currentClips.Add(loadSound("word_negative")); currentClips.Add(numberClip); } else { currentClips.Add(loadSound("all_find_todo_2")); currentClips.Add(loadSound("word_negative")); currentClips.Add(numberClip); } } else if (numberToFind > 0) { int rand = Random.Range(0, 3); if (rand == 0) { currentClips.Add(loadSound("ordinal_number_todo_1_a")); currentClips.Add(o_numberClip); currentClips.Add(loadSound("flowers_find_todo_1_b")); } else if (rand == 1) { currentClips.Add(loadSound("flowers_find_todo_1_a")); currentClips.Add(numberClip); } else if (rand == 2) { currentClips.Add(loadSound("flowers_find_todo_2_a")); currentClips.Add(o_numberClip); currentClips.Add(loadSound("flowers_find_todo_1_b")); } else { currentClips.Add(loadSound("all_find_todo_2")); currentClips.Add(numberClip); } } else { currentClips.Add(loadSound("all_find_todo_2")); currentClips.Add(numberClip); } playAudioList(currentClips); }
public void goToGame() { AGGameIndex index = (AGGameIndex)_currentGameIndex; AGGameState.startGame(index); }
public IEnumerator callNextGame(float delay) { yield return(new WaitForSeconds(delay)); AGGameState.loadNextGameInLoop(AGGameIndex.k_NamingFruits); // to play in loop }
// ----- Decide if tapped/dragged shape is correct?, play respective animations and decide to load next question or next level? private void decideForTappedDraggedShape(GameObject selection) { //Debug.Log("Decide for dragged shape"); ArrayList responseList = new ArrayList(); bool allShapesOnCurrentScreenPlayed; if (selection != null) { //isUserPlayedTheQuestion = true; totalAttempts++; shapeStatController = selection.GetComponent <PG_ShapeStatController>(); if (shapeStatController != null && shapeStatController.getAnswerShape()) { hideShadow(selection); jumpCount++; if (jumpCount == 1) { shapeStatController.isFirstShape = true; } else { shapeStatController.isFirstShape = false; } cross_tick_sign.transform.renderer.material.mainTexture = Resources.Load(PG_Constants._correctTick) as Texture; cross_tick_sign.transform.renderer.enabled = true; enableTouchesFlag = false; totalCorrects++; shapesTappedIndex++; if (gameMode == (int)GameModes.mode_counting) { responseList = islandControllerSR.ReplaceEmptyLandMassesWithFilledOne(shapesControllerSR.getQSpriteIndices().Count); } else { responseList = islandControllerSR.ReplaceEmptyLandMassesWithFilledOne(pgDataManager.getAnswersListCount()); } if (responseList.Count >= 2) { allShapesOnCurrentScreenPlayed = (bool)responseList[1]; } else { allShapesOnCurrentScreenPlayed = false; } //shapesControllerSR.shapeCorrectTapAnimation(selection,(GameObject)responseList[0]); shapeStatController.isLastShape = allShapesOnCurrentScreenPlayed; shapeStatController.shapeCorrectTapAnimation((GameObject)responseList[0]); StartCoroutine(hideReferentBubble(0.2F)); if (allShapesOnCurrentScreenPlayed) { AGGameState.incrementStarCount(); // increment stars enableTouchesFlag = false; StartCoroutine(ollyPondCrossAnimation(1.8F)); } } } isUserPlayedTheQuestion = false; }