public void InstantiateMotherStar(GameObject jewel) { deleteJewels.StampTimeCard(); // scoreKeeper.IncreaseScoreByFiveInLineBonus (); switch (jewel.tag) { case "Red Bomb": case "Red Block": instantiatedMotherStar = (GameObject)Instantiate(redMotherStar, jewel.transform.position, Quaternion.identity); break; case "Green Bomb": case "Green Block": instantiatedMotherStar = (GameObject)Instantiate(greenMotherStar, jewel.transform.position, Quaternion.identity); break; case "Purple Bomb": case "Purple Block": instantiatedMotherStar = (GameObject)Instantiate(purpleMotherStar, jewel.transform.position, Quaternion.identity); break; case "Blue Bomb": case "Blue Block": instantiatedMotherStar = (GameObject)Instantiate(blueMotherStar, jewel.transform.position, Quaternion.identity); break; case "Orange Bomb": case "Yellow Block": instantiatedMotherStar = (GameObject)Instantiate(orangeMotherStar, jewel.transform.position, Quaternion.identity); break; case "White Bomb": case "White Block": instantiatedMotherStar = (GameObject)Instantiate(whiteMotherStar, jewel.transform.position, Quaternion.identity); break; } soundHandler.PlayPowerUpSound(); motherStarList.Add(instantiatedMotherStar); }
public void ActivateCornersPowers(GameObject jewel) { deleteJewels.StampTimeCard(); ResetIntsAndBools(); switch (jewel.tag) { case "Green Bomb": case "Green Block": starToInstantiate = greenCornerStar; break; case "Red Bomb": case "Red Block": starToInstantiate = redCornerStar; break; case "Blue Bomb": case "Blue Block": starToInstantiate = blueCornerStar; break; case "White Bomb": case "White Block": starToInstantiate = whiteCornerStar; break; case "Orange Bomb": case "Yellow Block": starToInstantiate = orangeCornerStar; break; case "Purple Bomb": case "Purple Block": starToInstantiate = purpleCornerStar; break; } jewelMovement = jewel.GetComponent <RockLevelJewelMovement> (); if (jewelMovement.GetRow() + 1 < 9 && JewelsAreTheSame(instantiator.GetJewelGridGameObject(jewelMovement.GetRow() + 1, jewelMovement.GetCol()).tag, jewel.tag)) { starNumber++; negativeVerticalStar = true; } if (jewelMovement.GetRow() - 1 >= 0 && JewelsAreTheSame(instantiator.GetJewelGridGameObject(jewelMovement.GetRow() - 1, jewelMovement.GetCol()).tag, jewel.tag)) { starNumber++; positiveVerticalStar = true; } if (jewelMovement.GetCol() + 1 < 9 && JewelsAreTheSame(instantiator.GetJewelGridGameObject(jewelMovement.GetRow(), jewelMovement.GetCol() + 1).tag, jewel.tag)) { starNumber++; positiveHorizontalStar = true; } if (jewelMovement.GetCol() - 1 >= 0 && JewelsAreTheSame(instantiator.GetJewelGridGameObject(jewelMovement.GetRow(), jewelMovement.GetCol() - 1).tag, jewel.tag)) { starNumber++; negativeHorizontalStar = true; } InstantiateCornerStars(jewel); }
// Update is called once per frame void Update() { if (startDecent) { transform.Translate((targetX - transform.position.x) * Time.deltaTime * 15f, (targetY - transform.position.y) * Time.deltaTime * 15f, 0, Space.World); if (!targetJewelSet) { deleteJewels.StampTimeCard(); jewelToDestroy = instantiator.GetJewelGridGameObject(row, col); while (!PowerStarTracker.AddToHashSet(jewelToDestroy)) { row = Random.Range(0, 9); col = Random.Range(0, 9); jewelToDestroy = instantiator.GetJewelGridGameObject(row, col); crosshair.transform.position = new Vector3(-2.45f + (col * .6125f), 2.591252f - (row * .6097268f), -23); } targetJewelSet = true; } } if (startDecent && Mathf.Abs(targetX - transform.position.x) < .05f && Mathf.Abs(targetY - transform.position.y) < .05f) { if (jewelToDestroy != null) { if (IsJewel(gameObject.tag) || IsBomb(gameObject)) { jewelMovement = jewelToDestroy.GetComponent <RockLevelJewelMovement> (); jewelMovement.StartDestroyCountdown(); } if (jewelToDestroy != null && !swapJewel.IsASwapJewel(jewelToDestroy)) { deleteList.Add(jewelToDestroy); deleteJewels.DeleteAllJewelsInList(deleteList, true); } } Destroy(crosshair); fiveInARow.GetChildStarList().Remove(gameObject); if (fiveInARow.TutorialListContainsStar(gameObject)) { fiveInARow.RemoveStarFromTutorialList(gameObject); } Destroy(gameObject); } }
public void ActivateFourInARowPower(HashSet <GameObject> deleteList) { deleteJewels.StampTimeCard(); // scoreKeeper.IncreaseScoreByFourJewelBonus (); bool bombStarUsed = false; foreach (GameObject a in deleteList) { switch (a.tag) { case "Orange Bomb": case "Yellow Block": if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed) { InstantiateBombSeekingHomingStar(orangeHomingStar, a); bombStarUsed = true; } else { InstantiateHomingStar(orangeHomingStar, a); } break; case "Blue Bomb": case "Blue Block": if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed) { InstantiateBombSeekingHomingStar(blueHomingStar, a); bombStarUsed = true; } else { InstantiateHomingStar(blueHomingStar, a); } break; case "Green Bomb": case "Green Block": if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed) { InstantiateBombSeekingHomingStar(greenHomingStar, a); bombStarUsed = true; } else { InstantiateHomingStar(greenHomingStar, a); } break; case "Red Bomb": case "Red Block": if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed) { InstantiateBombSeekingHomingStar(redHomingStar, a); bombStarUsed = true; } else { InstantiateHomingStar(redHomingStar, a); } break; case "Purple Bomb": case "Purple Block": if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed) { InstantiateBombSeekingHomingStar(purpleHomingStar, a); bombStarUsed = true; } else { InstantiateHomingStar(purpleHomingStar, a); } break; case "White Bomb": case "White Block": if (bombHandler.GetBombListCount() > 0 && powerPercentageController.IsWithinPercentage() && !bombStarUsed) { InstantiateBombSeekingHomingStar(whiteHomingStar, a); bombStarUsed = true; } else { InstantiateHomingStar(whiteHomingStar, a); } break; } } targetJewels.Clear(); }