public void StageFourToStageThree() { name = "Slug Stage 3(Clone)"; currentBoulder = boulderStage3; gameObject.GetComponent <SpriteRenderer> ().sprite = redSprite; PowerStarTracker.RemoveFromHashSet(gameObject); }
public void StageThreeToStageTwo() { name = "Slug Stage 2(Clone)"; currentBoulder = boulderStage2; gameObject.GetComponent <SpriteRenderer> ().sprite = yellowSprite; PowerStarTracker.RemoveFromHashSet(gameObject); }
public void IfJewelSetToNull(GameObject jewel) { if (jewel1 == jewel || jewel2 == jewel) { PowerStarTracker.RemoveFromHashSet(jewel1); PowerStarTracker.RemoveFromHashSet(jewel2); jewel1 = null; jewel2 = null; } }
public void StageTwoToStageOne() { // SlugListManager.RemoveFromSlugList (gameObject); // GameObject tempSlug = (GameObject)Instantiate (slug, transform.position, Quaternion.identity); // RockLevelJewelMovement tempJewelMovement = tempSlug.GetComponent<RockLevelJewelMovement> (); // SlugListManager.AddToSlugList (tempSlug); // tempJewelMovement.SetBounced (true); // tempJewelMovement.SetRow (jewelMovement.GetRow ()); // tempJewelMovement.SetCol (jewelMovement.GetCol ()); // tempSlug.layer = gameObject.layer; // instantiator.SetJewelGridGameObject (tempJewelMovement.GetRow (), tempJewelMovement.GetCol (), tempSlug); // Destroy (gameObject); name = "Slug(Clone)"; currentBoulder = boulder; gameObject.GetComponent <SpriteRenderer> ().sprite = whiteSprite; PowerStarTracker.RemoveFromHashSet(gameObject); }
// Update is called once per frame void FixedUpdate() { if (startSwap) { if (jewel1 == null || jewel2 == null) { return; } jewel1.transform.Translate(new Vector3(-(jewel1.transform.position.x - jewelTwoOriginalPos.x) * translationMultiplier, -(jewel1.transform.position.y - jewelTwoOriginalPos.y) * translationMultiplier, 0)); jewel2.transform.Translate(new Vector3(-(jewel2.transform.position.x - jewelOneOriginalPos.x) * translationMultiplier, -(jewel2.transform.position.y - jewelOneOriginalPos.y) * translationMultiplier, 0)); if (Mathf.Abs(jewel1.transform.position.x - jewelTwoOriginalPos.x) < distanceToTarget && Mathf.Abs(jewel1.transform.position.y - jewelTwoOriginalPos.y) < distanceToTarget && Mathf.Abs(jewel2.transform.position.x - jewelOneOriginalPos.x) < distanceToTarget && Mathf.Abs(jewel2.transform.position.y - jewelOneOriginalPos.y) < distanceToTarget) { jewel1.transform.position = jewelTwoOriginalPos; jewel2.transform.position = jewelOneOriginalPos; jewel1.layer = secondJewelLayer; jewel2.layer = firstJewelLayer; startSwap = false; // firstJewelBlockMovement.moving = false; // secondJewelBlockMovement.moving = false; pauseTouchForSwap = false; } if (!startSwap) { jewel1.GetComponent <Rigidbody2D>().isKinematic = false; jewel2.GetComponent <Rigidbody2D>().isKinematic = false; instantiator.SetJewelGridGameObject(jewelOneMovement.GetRow(), jewelOneMovement.GetCol(), jewel1); instantiator.SetJewelGridGameObject(jewelTwoMovement.GetRow(), jewelTwoMovement.GetCol(), jewel2); jewelOneMovement = jewel1.GetComponent <RockLevelJewelMovement> (); jewelTwoMovement = jewel2.GetComponent <RockLevelJewelMovement> (); jewelOneMovement.SetMoving(false); jewelTwoMovement.SetMoving(false); if (jewelOneMovement.GetRow() < jewelTwoMovement.GetRow()) { if (!checkForMatches.CheckForSwapBack(jewel1, jewelOneMovement.GetRow(), jewelOneMovement.GetCol()) && !checkForMatches.CheckForSwapBack(jewel2, jewelTwoMovement.GetRow(), jewelTwoMovement.GetCol())) { if (!swapJewelsBack && restrictMovements) { Swap(jewel1, jewel2, true); } else { if (jewel1 != null) { PowerStarTracker.RemoveFromHashSet(jewel1); jewel1 = null; jewelOneMovement.SetSwappingJewel(false); } if (jewel2 != null) { PowerStarTracker.RemoveFromHashSet(jewel2); jewel2 = null; jewelTwoMovement.SetSwappingJewel(false); } } return; } deleteJewels.SetSwapComplete(true); if (!timeBombLevel && !jewelCollectorLevel) { bombHandler.DecreaseAllBombsInList(); } else if (jewelCollectorLevel) { Debug.Log("Calling moveNumberHandler.SubtractOneFromMoveNumber ()"); moveNumberHandler.SubtractOneFromMoveNumber(); } if (!firstSwapPerformed) { GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetFirstMoveMade(true); firstSwapPerformed = true; //Debug.Log ("First Swap Performed"); } if (jewel1 != null) { PowerStarTracker.RemoveFromHashSet(jewel1); jewel1 = null; jewelOneMovement.SetSwappingJewel(false); } if (jewel2 != null) { PowerStarTracker.RemoveFromHashSet(jewel2); jewel2 = null; jewelTwoMovement.SetSwappingJewel(false); } // stoppedMoving.SetGridStaticToFalse (); } else { if (!checkForMatches.CheckForSwapBack(jewel2, jewelTwoMovement.GetRow(), jewelTwoMovement.GetCol()) && !checkForMatches.CheckForSwapBack(jewel1, jewelOneMovement.GetRow(), jewelOneMovement.GetCol())) { if (!swapJewelsBack && restrictMovements) { Swap(jewel1, jewel2, true); } else { if (jewel1 != null) { PowerStarTracker.RemoveFromHashSet(jewel1); jewel1 = null; jewelOneMovement.SetSwappingJewel(false); } if (jewel2 != null) { PowerStarTracker.RemoveFromHashSet(jewel2); jewel2 = null; jewelTwoMovement.SetSwappingJewel(false); } } checkForMatches.deleteList.Clear(); return; } deleteJewels.SetSwapComplete(true); if (!timeBombLevel && !jewelCollectorLevel) { bombHandler.DecreaseAllBombsInList(); } else if (jewelCollectorLevel) { moveNumberHandler.SubtractOneFromMoveNumber(); } if (!firstSwapPerformed) { GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetFirstMoveMade(true); firstSwapPerformed = true; //Debug.Log ("First Swap Performed"); } if (jewel1 != null) { PowerStarTracker.RemoveFromHashSet(jewel1); jewel1 = null; jewelOneMovement.SetSwappingJewel(false); } if (jewel2 != null) { PowerStarTracker.RemoveFromHashSet(jewel2); jewel2 = null; jewelTwoMovement.SetSwappingJewel(false); } // stoppedMoving.SetGridStaticToFalse (); } } } }
public void Swap(GameObject firstJewel, GameObject secondJewel, bool swapBack) { // if (!swapBack && (PowerStarTracker.ContainsJewel (firstJewel) || PowerStarTracker.ContainsJewel (secondJewel))) { // return; // } jewel1 = firstJewel; jewel2 = secondJewel; if (firstJewel == null || secondJewel == null) { return; } jewelOneMovement = firstJewel.GetComponent <RockLevelJewelMovement> (); jewelOneMovement.SetSwappingJewel(true); jewelTwoMovement = secondJewel.GetComponent <RockLevelJewelMovement> (); jewelTwoMovement.SetSwappingJewel(true); PowerStarTracker.AddToHashSet(firstJewel); PowerStarTracker.AddToHashSet(secondJewel); soundHandler.ResetJewelBreakNumber(); soundHandler.PlayJewelSwap(); deleteJewels.PunchAssistanceTimeStamp(); swapJewelsBack = swapBack; pauseTouchForSwap = true; int tempRow, tempCol; deleteJewels.StampAssistantTimeCard(); // stoppedMoving.SetGridStaticToFalse (); if (jewelOneMovement.GetMoving() || jewelTwoMovement.GetMoving() || jewelOneMovement.GetToBeDestroyed() || jewelTwoMovement.GetToBeDestroyed()) { if (jewel1 != null) { PowerStarTracker.RemoveFromHashSet(jewel1); jewel1 = null; jewelOneMovement.SetSwappingJewel(false); } if (jewel2 != null) { PowerStarTracker.RemoveFromHashSet(jewel2); jewel2 = null; jewelTwoMovement.SetSwappingJewel(false); } return; } jewelOneMovement.SetMoving(true); jewelTwoMovement.SetMoving(true); tempRow = jewelOneMovement.GetRow(); tempCol = jewelOneMovement.GetCol();; jewelOneOriginalPos = firstJewel.transform.position; jewelTwoOriginalPos = secondJewel.transform.position; if (IsBomb(firstJewel) && !IsBomb(secondJewel)) { jewelTwoOriginalPos.x = jewelTwoOriginalPos.x + .035f; jewelOneOriginalPos.x = jewelOneOriginalPos.x - .035f; } else if (IsBomb(secondJewel) && !IsBomb(firstJewel)) { jewelOneOriginalPos.x = jewelOneOriginalPos.x + .035f; jewelTwoOriginalPos.x = jewelTwoOriginalPos.x - .035f; } jewelOneMovement.SetRow(jewelTwoMovement.GetRow()); jewelOneMovement.SetCol(jewelTwoMovement.GetCol()); jewelTwoMovement.SetRow(tempRow); jewelTwoMovement.SetCol(tempCol); jewel1.GetComponent <Rigidbody2D>().isKinematic = true; jewel2.GetComponent <Rigidbody2D>().isKinematic = true; firstJewelLayer = jewel1.layer; secondJewelLayer = jewel2.layer; jewel1.layer = 0; jewel2.layer = 0; startSwap = true; }
public void DeleteAllJewelsInList(HashSet <GameObject> deleteList, bool powerUpDelete) { removeList = new HashSet <GameObject> (); if (deleteList.Count >= 3) { soundHandler.PlayJewelBreak(); } assistanceTimeStamp = Time.time; timeStamp = Time.time; okayToMoveTimeStamp = Time.time; okayToMoveAgain = false; matchAssistant.SetResetRandoms(true); movementChecker.SetGridStaticToFalse(); GameObject tempJewel; if (deleteList.Count == 4) { soundHandler.PlayPowerUpSound(); fourInARowScript.ActivateFourInARowPower(deleteList); // scoreKeeper.IncreaseScoreByFourJewelBonus (); } foreach (GameObject a in deleteList) { if (a != null) { if (!powerUpDelete && a.tag != "Boulder") { jewelMovement = a.GetComponent <RockLevelJewelMovement> (); if (jewelMovement.GetRow() + 1 < 9) { CheckForBoulders(jewelMovement.GetRow() + 1, jewelMovement.GetCol()); } if (jewelMovement.GetRow() - 1 >= 0) { CheckForBoulders(jewelMovement.GetRow() - 1, jewelMovement.GetCol()); } if (jewelMovement.GetCol() + 1 < 9) { CheckForBoulders(jewelMovement.GetRow(), jewelMovement.GetCol() + 1); } if (jewelMovement.GetCol() - 1 >= 0) { CheckForBoulders(jewelMovement.GetRow(), jewelMovement.GetCol() - 1); } } if (a.tag == "Boulder") { jewelMovement = a.GetComponent <RockLevelJewelMovement> (); if (CheckForBoulders(jewelMovement.GetRow(), jewelMovement.GetCol())) { removeList.Add(a); } } } } foreach (GameObject a in removeList) { deleteList.Remove(a); } foreach (GameObject a in boulderDeleteList) { deleteList.Add(a); } foreach (GameObject a in deleteList) { if (a != null) { deleteListCopy = deleteList; if (a != null && a.tag == "Steel Block") { PowerStarTracker.RemoveFromHashSet(a); } if (a != null && a.tag != "Steel Block" && a.name != "Rock 3 Chain(Clone)" && a.name != "Rock 2 Chain(Clone)" && a.name != "Rock 1 Chain(Clone)") { jewelMovement = a.GetComponent <RockLevelJewelMovement> (); // moveJewelsDown.MoveJewelsAboveDown(a); // if (GameObject.Find ("Time Bomb ID") != null) { // if (addJewels == null) // addJewels = GameObject.Find ("Time Bomb ID").GetComponent<AddTimeLevelOneJewels> (); // if (Bomb(a) && !bombHandler.TimeBombIsExploded ()) { // bombHandler.RemoveFromBombList (a); // addJewels.InstantiateSingleJewels (jewelMovement.GetCol (), true); // } else if (!bombHandler.TimeBombIsExploded ()) // addJewels.InstantiateSingleJewels (jewelMovement.GetCol (), false); // else if (bombHandler.TimeBombIsExploded ()) { // addJewels.InstantiateOnlyJewels (jewelMovement.GetCol ()); // } // } // else // instantiator.InstantiateSingleJewels (jewelMovement.GetRow (), jewelMovement.GetCol ()); if (Bomb(a) && GameObject.Find("Time Bomb ID") == null) { GameObject tempNumber = null; for (int i = 0; i < a.transform.childCount; i++) { if (a.transform.GetChild(i).tag == "Bomb Number") { tempNumber = a.transform.GetChild(i).gameObject; break; } } if (tempNumber != null) { tempNumber.transform.parent = null; tempNumber.GetComponent <BombNumberHandler> ().SetBombDestroyed(true); } if (bombHandler.GetBombListCount() == 1) { //Debug.Log ("Setting touch to fault"); touchHandler.SetGameStarted(false); } // bombInfo = a.GetComponent<LevelTwoBombInfo> (); // Instantiate (bombInfo.GetBombNumberSprite (), a.transform.position, Quaternion.identity); } else if (Bomb(a) && GameObject.Find("Time Bomb ID") != null) { GameObject tempBomb; // bombInfo = a.GetComponent<LevelTwoBombInfo> (); a.GetComponent <Rigidbody2D>().isKinematic = true; // bombInfo.SetBombDestroyed (true); } } } } boulderDeleteList.Clear(); foreach (GameObject a in deleteList) { if (a != null) { if (explosionsOn) { InstantiateExplosions(a); } if (a.tag != "Steel Block") { scoreKeeper.IncreaseScoreByOneJewel(); if (bombHandler.BombListContains(a)) { jewelMovement = a.GetComponent <RockLevelJewelMovement> (); bombHandler.RemoveFromBombList(a); bombHandler.DecreaseBombCounterByOne(); // scoreKeeper.IncreaseScoreByOneBomb (); } if (/*(GameObject.Find ("Time Bomb ID") == null || (GameObject.Find ("Time Bomb ID") != null && !Bomb (a))) &&*/ a.name != "Rock 3 Chain(Clone)" && a.name != "Rock 2 Chain(Clone)" && a.name != "Rock 1 Chain(Clone)") { if (GameObject.Find("Time Bomb ID") != null && Bomb(a)) { bombDestroyed = true; } tempPositionHolder = new PositionHolder(a.GetComponent <RockLevelJewelMovement> ().GetRow(), a.GetComponent <RockLevelJewelMovement> ().GetCol()); deletedPositions.Add(tempPositionHolder); int row = a.GetComponent <RockLevelJewelMovement> ().GetRow(); int col = a.GetComponent <RockLevelJewelMovement> ().GetCol(); a.GetComponent <RockLevelJewelMovement> ().StartDestroyCountdown(); PowerStarTracker.RemoveFromHashSet(a); if (a.name == "Slug(Clone)") { SlugListManager.RemoveFromSlugList(a); } if (GameObject.Find("Jewel Collection Level ID") != null && !endOfLevelJewelSprayer.GetSprayingInProgress()) { InstantiateStaticJewel(a); } Destroy(a); instantiator.SetJewelGridGameObject(row, col, null); // moveJewelsDown.MoveJewelsAboveDown (tempPositionHolder.GetCol (), tempPositionHolder.GetRow ()); // instantiator.InstantiateSingleJewels (tempPositionHolder.GetRow (), tempPositionHolder.GetCol ()); } } } } // deleteCount++; // // if (deleteCount == 3) { // deleteCount = 0; // GameObject.Find ("Pump Up Word Holder").GetComponent<PumpUpWordHolder> ().InstantiateWow (); // } powerTrackerTimestamp = Time.time; swapMadeTimestamp = Time.time; // if (swapComplete) { // swapComplete = false; // SlugListManager.MoveAllSlugs (); // } deleteList.Clear(); foreach (PositionHolder a in deletedPositions) { // //Debug.Log ("deletePositions.Size = " + deletedPositions.Count); int row = a.GetRow(); int col = a.GetCol(); moveJewelsDown.MoveJewelsAboveDown(col, row); // instantiator.InstantiateSingleJewels (row, col); //// while (row >= 0 && instantiator.GetJewelGridGameObject (row, col) == null) //// row--; //// if (instantiator.GetJewelGridGameObject (row, col) != null) //// instantiator.GetJewelGridGameObject (row, col).GetComponent<RockLevelJewelMovement> ().MoveDown (false); } List <PositionHolder> nullPositions = null; if (!starShooter.GetStartLaunchingStars()) { nullPositions = new List <PositionHolder> (); int positionTotal = deletedPositions.Count, nullCount = 0; bool breakSecondLoop = false; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (instantiator.GetJewelGridGameObject(i, j) == null) { nullCount++; nullPositions.Add(new PositionHolder(i, j)); if (nullCount >= positionTotal) { breakSecondLoop = true; } } } if (breakSecondLoop) { break; } } } foreach (PositionHolder a in deletedPositions) { if (tutorialLevel1) { instantiator.InstantiateLevelOneTutorialJewels(a.GetRow(), a.GetCol()); } else if (tutorialLevel2) { instantiator.InstantiateLevelTwoTutorialJewels(a.GetRow(), a.GetCol()); } else if (tutorialLevel3) { instantiator.InstantiateLevelThreeTutorialJewels(a.GetRow(), a.GetCol()); } else if (tutorialLevel4) { instantiator.InstantiateLevelFourTutorialJewels(a.GetRow(), a.GetCol()); } else { instantiator.InstantiateSingleJewels(a.GetRow(), a.GetCol()); } } if (!starShooter.GetStartLaunchingStars()) { int whileCount = 0; if (!tutorialLevel1 && !tutorialLevel2 && !tutorialLevel3 && noMatchChecker.CheckForNoMatchesWithoutShuffle() && noMatchCount < 3) { Debug.Log("MAKING A NEW MATCH"); noMatchCount++; do { foreach (PositionHolder a in nullPositions) { Destroy(instantiator.GetJewelGridGameObject(a.GetRow(), a.GetCol())); instantiator.SetJewelGridGameObject(a.GetRow(), a.GetCol(), null); instantiator.InstantiateSingleJewels(a.GetRow(), a.GetCol()); } if (whileCount > 100) { Debug.Log("WHILECOUNT BREAK"); break; } whileCount++; } while (noMatchChecker.CheckForNoMatchesWithoutShuffle()); } else { noMatchCount = 0; } } deletedPositions.Clear(); // foreach (PositionHolder a in boulderHolder) { // if (instantiator.GetJewelGridGameObject (a.GetRow (), a.GetCol ()) != null) { // checkForMatches.CheckForSwapBack (instantiator.GetJewelGridGameObject (a.GetRow (), a.GetCol ()), a.GetRow (), a.GetCol ()); // } // } // boulderHolder.Clear (); // if (shadeCount == 0 || shadeCount == 1) { // shadeController = controller.GetCurrentTutorialShade ().GetComponent<LevelTwoTutorialShadeController> (); // shadeController.MakeInvisible (); // shadeCount++; // } // if (swapComplete) { // swapComplete = false; // SlugListManager.MoveAllSlugs (); // } }
// bool CheckForBouldersForBoulders (int row, int col) { // tempBoulder = instantiator.GetJewelGridGameObject (row, col); // if (tempBoulder != null && tempBoulder.name == "Rock 3 Chain(Clone)") { // PowerStarTracker.AddToHashSet (tempBoulder); // tempBoulder.name = "Rock 2 Chain(Clone)"; // tempBoulder.GetComponent<SpriteRenderer> ().sprite = boulderSprite3; // } // else if (tempBoulder != null && tempBoulder.name == "Rock 2 Chain(Clone)") { // PowerStarTracker.AddToHashSet (tempBoulder); // tempBoulder.name = "Rock 1 Chain(Clone)"; // tempBoulder.GetComponent<SpriteRenderer> ().sprite = boulderSprite2; // } // else if (tempBoulder != null && tempBoulder.name == "Slug Stage 3(Clone)") { // tempBoulder.GetComponent<SlugMovementController> ().StageThreeToStageTwo (); // return true; // } // else if (tempBoulder != null && tempBoulder.name == "Rock 1 Chain(Clone)") { // PowerStarTracker.AddToHashSet (tempBoulder); // tempBoulder.name = "Rock Blocked(Clone)"; // tempBoulder.GetComponent<SpriteRenderer> ().sprite = boulderSprite; // } // else if (tempBoulder != null && tempBoulder.name == "Slug Stage 2(Clone)") { // tempBoulder.GetComponent<SlugMovementController> ().StageTwoToStageOne (); // return true; // } // else if (tempBoulder != null && tempBoulder.name == "Rock Blocked(Clone)") { // tempBoulder.GetComponent<RockLevelJewelMovement> ().AddToRocksToBeDestroyed (tempBoulder); // boulderDeleteList.Add (tempBoulder); // } // else if (tempBoulder != null && tempBoulder.name == "Slug(Clone)") { // if (tempBoulder.transform.childCount > 1) { // Sprite tempBombSprite = null; // switch (Random.Range (0, 6)) { // case 0: tempBombSprite = blueBombSprite; tempBoulder.name = "Blue Bomb"; tempBoulder.tag = "Blue Bomb"; break; // case 1: tempBombSprite = greenBombSprite; tempBoulder.name = "Green Bomb"; tempBoulder.tag = "Green Bomb"; break; // case 2: tempBombSprite = orangeBombSprite; tempBoulder.name = "Orange Bomb"; tempBoulder.tag = "Orange Bomb"; break; // case 3: tempBombSprite = purpleBombSprite; tempBoulder.name = "Purple Bomb"; tempBoulder.tag = "Purple Bomb"; break; // case 4: tempBombSprite = redBombSprite; tempBoulder.name = "Red Bomb"; tempBoulder.tag = "Red Bomb"; break; // case 5: tempBombSprite = whiteBombSprite; tempBoulder.name = "White Bomb"; tempBoulder.tag = "White Bomb"; break; // } // if (tempBoulder.transform.GetChild (0).tag == "Slug Eyes") { // Destroy (tempBoulder.GetComponent<SlugEyeController> ()); // Destroy (tempBoulder.GetComponent<SlugMovementController> ()); // SlugListManager.RemoveFromSlugList (tempBoulder); // Instantiate (whiteExplosion, new Vector3 (tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler (-90, 0, 0)); // Destroy (tempBoulder.transform.GetChild (0).gameObject); // } // // else if (tempBoulder.transform.GetChild (1).tag == "Slug Eyes") { // Destroy (tempBoulder.GetComponent<SlugEyeController> ()); // Destroy (tempBoulder.GetComponent<SlugMovementController> ()); // SlugListManager.RemoveFromSlugList (tempBoulder); // Instantiate (whiteExplosion, new Vector3 (tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler (-90, 0, 0)); // Destroy (tempBoulder.transform.GetChild (1).gameObject); // } // // tempBoulder.transform.localScale = new Vector3 (.1f, .1f, 1f); // tempBoulder.GetComponent<BoxCollider2D> ().size = new Vector2 (5.47f, 6); // tempBoulder.GetComponent<SpriteRenderer> ().sprite = tempBombSprite; // GameObject instantiatedBombSpark = (GameObject) Instantiate(bombSpark, new Vector3 (tempBoulder.transform.position.x + .212f, tempBoulder.transform.position.y + .247f, tempBoulder.transform.position.z - .1f), Quaternion.identity); // instantiatedBombSpark.transform.parent = tempBoulder.transform; // int newRow = tempBoulder.GetComponent<RockLevelJewelMovement> ().GetRow (); // int newCol = tempBoulder.GetComponent<RockLevelJewelMovement> ().GetCol (); // tempBoulder.transform.position = new Vector3 (startingLeftJewelPosition + (horizontalMultiplier * newCol), 2.591258f - (.61f * newRow), (-1 * newRow) - 2); // // // if (tempBoulder.transform.GetChild (0).tag == "Bomb Number") { // tempBoulder.transform.GetChild (0).gameObject.transform.position = new Vector3 (tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - .1f); // } // else if (tempBoulder.transform.GetChild (1).tag == "Bomb Number") { // tempBoulder.transform.GetChild (1).gameObject.transform.position = new Vector3 (tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - .1f); // } // tempBoulder.GetComponent<Rigidbody2D> ().isKinematic = false; // return true; // } // else { // tempBoulder.GetComponent<RockLevelJewelMovement> ().AddToRocksToBeDestroyed (tempBoulder); // boulderDeleteList.Add (tempBoulder); // } // } // return false; // } // bool CheckForBouldersForBoulders (int row, int col) { // tempBoulder = instantiator.GetJewelGridGameObject (row, col); // if (tempBoulder != null && tempBoulder.name == "Rock 3 Chain(Clone)") { // PowerStarTracker.AddToHashSet (tempBoulder);new Vector3 (startingLeftJewelPosition + (horizontalMultiplier * j), Random.Range (10, 15), (-1 * i) - 2) // Vector3 boulderPosition = tempBoulder.transform.position; // int boulderLayer = tempBoulder.layer; // Destroy (tempBoulder); // instantiator.SetJewelGridGameObject (row, col, (GameObject) Instantiate (boulderChain2, boulderPosition, Quaternion.identity)); // tempBoulder = instantiator.GetJewelGridGameObject (row, col); // tempBoulder.layer = boulderLayer; // RockLevelJewelMovement boulderMovement = tempBoulder.GetComponent<RockLevelJewelMovement> (); // boulderMovement.SetBounced (true); // boulderMovement.SetRow (row); // boulderMovement.SetCol (col); // } // else if (tempBoulder != null && (tempBoulder.name == "Rock 2 Chain(Clone)" || tempBoulder.name == "Slug Stage 3(Clone)")) { // if (tempBoulder.name == "Slug Stage 3(Clone)") { // tempBoulder.GetComponent<SlugMovementController> ().StageThreeToStageTwo (); // return true; // } else { // PowerStarTracker.AddToHashSet (tempBoulder); // Vector3 boulderPosition = tempBoulder.transform.position; // int boulderLayer = tempBoulder.layer; // Destroy (tempBoulder); // instantiator.SetJewelGridGameObject (row, col, (GameObject) Instantiate (boulderChain1, boulderPosition, Quaternion.identity)); // tempBoulder = instantiator.GetJewelGridGameObject (row, col); // tempBoulder.layer = boulderLayer; // RockLevelJewelMovement boulderMovement = tempBoulder.GetComponent<RockLevelJewelMovement> (); // boulderMovement.SetBounced (true); // boulderMovement.SetRow (row); // boulderMovement.SetCol (col); // } // } // else if (tempBoulder != null && (tempBoulder.name == "Rock 1 Chain(Clone)" || tempBoulder.name == "Slug Stage 2(Clone)")) { // if (tempBoulder.name == "Slug Stage 2(Clone)") { //// SlugListManager.RemoveFromSlugList (tempBoulder); //// Destroy (tempBoulder); //// instantiator.SetJewelGridGameObject (row, col, (GameObject) Instantiate (slug, boulderPosition, Quaternion.identity)); //// SlugListManager.AddToSlugList (tempBoulder); // tempBoulder.GetComponent<SlugMovementController> ().StageTwoToStageOne (); // return true; // } else { // PowerStarTracker.AddToHashSet (tempBoulder); // Vector3 boulderPosition = tempBoulder.transform.position; // int boulderLayer = tempBoulder.layer; // bombHandler.RemoveFromBombList (tempBoulder); // Instantiate (whiteExplosion, new Vector3 (tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler (-90, 0, 0)); // Destroy (tempBoulder); // instantiator.SetJewelGridGameObject (row, col, (GameObject) Instantiate (boulder, boulderPosition, Quaternion.identity)); // tempBoulder = instantiator.GetJewelGridGameObject (row, col); // tempBoulder.layer = boulderLayer; // RockLevelJewelMovement boulderMovement = tempBoulder.GetComponent<RockLevelJewelMovement> (); // boulderMovement.SetBounced (true); // boulderMovement.SetRow (row); // boulderMovement.SetCol (col); // bombHandler.AddBombToList (tempBoulder); // } // } // // else if (row >= 0 && (tempBoulder.name == "Rock Blocked(Clone)" || tempBoulder.name == "Slug(Clone)")) { // if (tempBoulder.transform.childCount > 1) { // PowerStarTracker.AddToHashSet (tempBoulder); // Vector3 boulderPosition = new Vector3 (startingLeftJewelPosition + (horizontalMultiplier * col), 2.591258f - (.61f * row), (-1 * row) - 2); //// Vector3 boulderPosition = tempBoulder.transform.position; // int boulderLayer = tempBoulder.layer; // GameObject bombNumber = null; // if (tempBoulder.transform.GetChild (0) != null && tempBoulder.transform.GetChild (0).tag == "Bomb Number") // bombNumber = tempBoulder.transform.GetChild (0).gameObject; // else if (tempBoulder.transform.GetChild (1) != null && tempBoulder.transform.GetChild (1).tag == "Bomb Number") // bombNumber = tempBoulder.transform.GetChild (1).gameObject; // bombNumber.transform.parent = null; // tempBoulder.GetComponent<SlugMovementController> ().BeingDeleted (true); // bombHandler.RemoveFromBombList (tempBoulder); // Instantiate (whiteExplosion, new Vector3 (tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler (-90, 0, 0)); // Destroy (tempBoulder); // instantiator.SetJewelGridGameObject (row, col, GetRandomBomb (boulderPosition, bombNumber)); // Debug.Log ("Child 0 = " + instantiator.GetJewelGridGameObject (row, col).transform.GetChild (0) + " Child 1 = " + instantiator.GetJewelGridGameObject (row, col).transform.GetChild (1)); // tempBoulder = instantiator.GetJewelGridGameObject (row, col); // bombHandler.AddBombToList (tempBoulder); // bombNumber.transform.position = new Vector3 (tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - .1f); // tempBoulder.layer = boulderLayer; // RockLevelJewelMovement boulderMovement = tempBoulder.GetComponent<RockLevelJewelMovement> (); // boulderMovement.SetBounced (true); // boulderMovement.SetRow (row); // boulderMovement.SetCol (col); // return true; // } else { // tempBoulder.GetComponent<RockLevelJewelMovement> ().AddToRocksToBeDestroyed (tempBoulder); // boulderDeleteList.Add (tempBoulder); // } // } // return false; // } bool CheckForBoulders(int row, int col) { tempBoulder = instantiator.GetJewelGridGameObject(row, col); if (tempBoulder != null && tempBoulder.name == "Rock 3 Chain(Clone)") { tempBoulder.name = "Rock 2 Chain(Clone)"; tempBoulder.GetComponent <SpriteRenderer> ().sprite = boulderSprite3; tempBoulder.GetComponent <RockLevelJewelMovement> ().SetAddedToArray(false); PowerStarTracker.RemoveFromHashSet(tempBoulder); return(true); } else if (tempBoulder != null && tempBoulder.name == "Rock 2 Chain(Clone)") { tempBoulder.name = "Rock 1 Chain(Clone)"; tempBoulder.GetComponent <SpriteRenderer> ().sprite = boulderSprite2; tempBoulder.GetComponent <RockLevelJewelMovement> ().SetAddedToArray(false); PowerStarTracker.RemoveFromHashSet(tempBoulder); Instantiate(redExplosion, new Vector3(tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler(-90, 0, 0)); return(true); } else if (tempBoulder != null && tempBoulder.name == "Slug Stage 4(Clone)") { tempBoulder.GetComponent <SlugMovementController> ().StageFourToStageThree(); tempBoulder.GetComponent <RockLevelJewelMovement> ().SetAddedToArray(false); PowerStarTracker.RemoveFromHashSet(tempBoulder); return(true); } else if (tempBoulder != null && tempBoulder.name == "Slug Stage 3(Clone)") { tempBoulder.GetComponent <SlugMovementController> ().StageThreeToStageTwo(); tempBoulder.GetComponent <RockLevelJewelMovement> ().SetAddedToArray(false); PowerStarTracker.RemoveFromHashSet(tempBoulder); Instantiate(redExplosion, new Vector3(tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler(-90, 0, 0)); return(true); } else if (tempBoulder != null && tempBoulder.name == "Rock 1 Chain(Clone)") { tempBoulder.name = "Rock Blocked(Clone)"; tempBoulder.GetComponent <SpriteRenderer> ().sprite = boulderSprite; tempBoulder.GetComponent <RockLevelJewelMovement> ().SetAddedToArray(false); PowerStarTracker.RemoveFromHashSet(tempBoulder); Instantiate(yellowBlockExplosion, new Vector3(tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler(-90, 0, 0)); return(true); } else if (tempBoulder != null && tempBoulder.name == "Slug Stage 2(Clone)") { tempBoulder.GetComponent <SlugMovementController> ().StageTwoToStageOne(); tempBoulder.GetComponent <RockLevelJewelMovement> ().SetAddedToArray(false); PowerStarTracker.RemoveFromHashSet(tempBoulder); Instantiate(yellowBlockExplosion, new Vector3(tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler(-90, 0, 0)); return(true); } else if (tempBoulder != null && tempBoulder.name == "Rock Blocked(Clone)") { if (tempBoulder.transform.childCount > 0 && bombHandler.BombListContains(tempBoulder)) { Sprite tempBombSprite = null; switch (Random.Range(0, 6)) { case 0: tempBombSprite = blueBombSprite; tempBoulder.name = "Blue Bomb"; tempBoulder.tag = "Blue Bomb"; break; case 1: tempBombSprite = greenBombSprite; tempBoulder.name = "Green Bomb"; tempBoulder.tag = "Green Bomb"; break; case 2: tempBombSprite = orangeBombSprite; tempBoulder.name = "Orange Bomb"; tempBoulder.tag = "Orange Bomb"; break; case 3: tempBombSprite = purpleBombSprite; tempBoulder.name = "Purple Bomb"; tempBoulder.tag = "Purple Bomb"; break; case 4: tempBombSprite = redBombSprite; tempBoulder.name = "Red Bomb"; tempBoulder.tag = "Red Bomb"; break; case 5: tempBombSprite = whiteBombSprite; tempBoulder.name = "White Bomb"; tempBoulder.tag = "White Bomb"; break; } for (int i = 0; i < tempBoulder.transform.childCount; i++) { if (tempBoulder.transform.GetChild(i).tag == "Slug Eyes") { Destroy(tempBoulder.GetComponent <SlugEyeController> ()); Destroy(tempBoulder.GetComponent <SlugMovementController> ()); SlugListManager.RemoveFromSlugList(tempBoulder); Instantiate(whiteExplosion, new Vector3(tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler(-90, 0, 0)); Destroy(tempBoulder.transform.GetChild(i).gameObject); break; } } tempBoulder.transform.localScale = new Vector3(.1f, .1f, 1f); tempBoulder.GetComponent <BoxCollider2D> ().size = new Vector2(5.47f, 6); tempBoulder.GetComponent <SpriteRenderer> ().sprite = tempBombSprite; GameObject instantiatedBombSpark = (GameObject)Instantiate(bombSpark, new Vector3(tempBoulder.transform.position.x + .212f, tempBoulder.transform.position.y + .247f, tempBoulder.transform.position.z - .1f), Quaternion.identity); instantiatedBombSpark.transform.parent = tempBoulder.transform; int newRow = tempBoulder.GetComponent <RockLevelJewelMovement> ().GetRow(); int newCol = tempBoulder.GetComponent <RockLevelJewelMovement> ().GetCol(); tempBoulder.transform.position = new Vector3(startingLeftJewelPosition + (horizontalMultiplier * newCol), 2.591258f - (.61f * newRow), (-1 * newRow) - 2); tempBoulder.layer = row + 17; for (int i = 0; i < tempBoulder.transform.childCount; i++) { if (tempBoulder.transform.GetChild(i).tag == "Bomb Number") { tempBoulder.transform.GetChild(i).gameObject.transform.position = new Vector3(tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - .1f); break; } } tempBoulder.GetComponent <Rigidbody2D> ().isKinematic = false; tempBoulder.GetComponent <RockLevelJewelMovement> ().SetAddedToArray(false); PowerStarTracker.RemoveFromHashSet(tempBoulder); tempBoulder.GetComponent <Rigidbody2D> ().AddForce(new Vector3(0, 300)); return(true); } else { tempBoulder.GetComponent <RockLevelJewelMovement> ().AddToRocksToBeDestroyed(tempBoulder); boulderDeleteList.Add(tempBoulder); return(false); } } else if (tempBoulder != null && tempBoulder.name == "Slug(Clone)") { if (tempBoulder.transform.childCount > 1 && bombHandler.BombListContains(tempBoulder)) { Sprite tempBombSprite = null; switch (Random.Range(0, 6)) { case 0: tempBombSprite = blueBombSprite; tempBoulder.name = "Blue Bomb"; tempBoulder.tag = "Blue Bomb"; break; case 1: tempBombSprite = greenBombSprite; tempBoulder.name = "Green Bomb"; tempBoulder.tag = "Green Bomb"; break; case 2: tempBombSprite = orangeBombSprite; tempBoulder.name = "Orange Bomb"; tempBoulder.tag = "Orange Bomb"; break; case 3: tempBombSprite = purpleBombSprite; tempBoulder.name = "Purple Bomb"; tempBoulder.tag = "Purple Bomb"; break; case 4: tempBombSprite = redBombSprite; tempBoulder.name = "Red Bomb"; tempBoulder.tag = "Red Bomb"; break; case 5: tempBombSprite = whiteBombSprite; tempBoulder.name = "White Bomb"; tempBoulder.tag = "White Bomb"; break; } tempBoulder.transform.localScale = new Vector3(.1f, .1f, 1f); tempBoulder.GetComponent <BoxCollider2D> ().size = new Vector2(5.47f, 6); tempBoulder.GetComponent <SpriteRenderer> ().sprite = tempBombSprite; GameObject instantiatedBombSpark = (GameObject)Instantiate(bombSpark, new Vector3(tempBoulder.transform.position.x + .212f, tempBoulder.transform.position.y + .247f, tempBoulder.transform.position.z - .1f), Quaternion.identity); instantiatedBombSpark.transform.parent = tempBoulder.transform; int newRow = tempBoulder.GetComponent <RockLevelJewelMovement> ().GetRow(); int newCol = tempBoulder.GetComponent <RockLevelJewelMovement> ().GetCol(); tempBoulder.transform.position = new Vector3(startingLeftJewelPosition + (horizontalMultiplier * newCol), 2.591258f - (.61f * newRow), (-1 * newRow) - 2); tempBoulder.layer = row + 17; for (int i = 0; i < tempBoulder.transform.childCount; i++) { if (tempBoulder.transform.GetChild(i).tag == "Slug Eyes") { Destroy(tempBoulder.GetComponent <SlugEyeController> ()); Destroy(tempBoulder.GetComponent <SlugMovementController> ()); SlugListManager.RemoveFromSlugList(tempBoulder); Instantiate(whiteExplosion, new Vector3(tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - 10), Quaternion.Euler(-90, 0, 0)); DestroySlugEyes(tempBoulder); break; } } for (int i = 0; i < tempBoulder.transform.childCount; i++) { if (tempBoulder.transform.GetChild(i).tag == "Bomb Number") { tempBoulder.transform.GetChild(i).gameObject.transform.position = new Vector3(tempBoulder.transform.position.x, tempBoulder.transform.position.y, tempBoulder.transform.position.z - .1f); break; } } tempBoulder.GetComponent <Rigidbody2D> ().isKinematic = false; tempBoulder.GetComponent <RockLevelJewelMovement> ().SetAddedToArray(false); PowerStarTracker.RemoveFromHashSet(tempBoulder); tempBoulder.GetComponent <Rigidbody2D> ().AddForce(new Vector3(0, 300)); return(true); } else { tempBoulder.GetComponent <RockLevelJewelMovement> ().AddToRocksToBeDestroyed(tempBoulder); boulderDeleteList.Add(tempBoulder); return(false); } } return(false); }