Example #1
0
    private void InstantiateBombSeekingHomingStar(GameObject star, GameObject jewel)
    {
        GameObject instantiatedStar = (GameObject)Instantiate(star, new Vector3(jewel.transform.position.x, jewel.transform.position.y, -49), Quaternion.identity);

        homingStarMovement = instantiatedStar.GetComponent <RockLevelHomingStarMovement> ();
        jewelMovement      = jewel.GetComponent <RockLevelJewelMovement> ();
        GameObject randomBomb = bombHandler.GetRandomBomb();

        random1 = randomBomb.GetComponent <RockLevelJewelMovement> ().GetRow();
        random2 = randomBomb.GetComponent <RockLevelJewelMovement> ().GetCol();
        if (instantiator.GetJewelGridGameObject(random1, random2) != null)
        {
            jewelMovement2 = instantiator.GetJewelGridGameObject(random1, random2).GetComponent <RockLevelJewelMovement> ();
        }
        while (instantiator.GetJewelGridGameObject(random1, random2) == null || (random1 == jewelMovement.GetRow() && random2 == jewelMovement.GetCol()) || checkForMatches.deleteList.Contains(instantiator.GetJewelGridGameObject(random1, random2)) || jewelMovement2.GetMoving() || !targetJewels.Add(instantiator.GetJewelGridGameObject(random1, random2)))
        {
            random1 = Random.Range(0, 9);
            random2 = Random.Range(0, 9);
            if (instantiator.GetJewelGridGameObject(random1, random2) != null)
            {
                jewelMovement2 = instantiator.GetJewelGridGameObject(random1, random2).GetComponent <RockLevelJewelMovement> ();
            }
        }
        homingStarMovement.SetRow(random1);
        homingStarMovement.SetCol(random2);
        homingStarMovement.SetFourInARowStar();
        homingStarList.Add(instantiatedStar);
    }
    void InstantiateHomingStar()
    {
//		Debug.Log ("Instantiating Shooting Star");
        tempStar           = (GameObject)Instantiate(GetRandomStar(), starStartingPosition, Quaternion.identity);
        homingStarMovement = tempStar.GetComponent <RockLevelHomingStarMovement> ();
        row           = Random.Range(0, 9);
        col           = Random.Range(0, 9);
        jewelMovement = instantiator.GetJewelGridGameObject(row, col).GetComponent <RockLevelJewelMovement> ();
        while (!PowerStarTracker.AddToHashSet(instantiator.GetJewelGridGameObject(row, col)))
        {
            row = Random.Range(0, 9);
            col = Random.Range(0, 9);
        }
//		jewelMovement = instantiator.GetJewelGridGameObject (row, col).GetComponent<RockLevelJewelMovement> ();
//		while (jewelMovement.GetMoving () || !PowerStarTracker.AddToHashSet (instantiator.GetJewelGridGameObject (row, col))) {
//			row = Random.Range (0, 9);
//			col = Random.Range (0, 9);
//			while (instantiator.GetJewelGridGameObject (row, col) == null) {
//				row = Random.Range (0, 9);
//				col = Random.Range (0, 9);
//			}
//			jewelMovement = instantiator.GetJewelGridGameObject (row, col).GetComponent<RockLevelJewelMovement> ();
//		}
        homingStarMovement.SetRow(row);
        homingStarMovement.SetCol(col);
    }
Example #3
0
    void InstantiateTutorialTwoHomingStar(GameObject star, GameObject jewel)
    {
        GameObject instantiatedStar = (GameObject)Instantiate(star, new Vector3(jewel.transform.position.x, jewel.transform.position.y, -49), Quaternion.identity);

        homingStarMovement = instantiatedStar.GetComponent <RockLevelHomingStarMovement> ();
        jewelMovement      = jewel.GetComponent <RockLevelJewelMovement> ();
        switch (tutorial2Count)
        {
        case 0: random1 = 7; random2 = 1; break;

        case 1: random1 = 6; random2 = 2; break;

        case 2: random1 = 5; random2 = 4; break;

        case 3: random1 = 1; random2 = 5; break;

        default: tutorialLevel2 = false; InstantiateHomingStar(star, jewel); return;
        }
        tutorial2Count++;
        homingStarMovement.SetRow(random1);
        homingStarMovement.SetCol(random2);
        homingStarMovement.SetFourInARowStar();
        homingStarList.Add(instantiatedStar);
    }