Example #1
0
    void CheckTouch3(Vector3 pos)
    {
        Vector3 wp       = Camera.main.ScreenToWorldPoint(pos);
        Vector2 touchPos = new Vector2(wp.x, wp.y);

        hit3 = Physics2D.OverlapPoint(touchPos);

        if (hit != null && hit.gameObject == gameObject && hit3 != null && hit3.gameObject == gameObject && StoreInventory.GetItemBalance("coin_currency_ID") < 250)
        {
            soundHandler.PlayButtonClickUp();
            GameObject.Find("Pause Button(Clone)").GetComponent <PauseButtonHandler> ().PauseGameRemotely();
            GameObject.Find("Screen Handlers").GetComponent <PurchaseCoinsScreenHandler> ().InstantiateCameraOffsetScreen();
            //Debug.Log ("Not enough scratch for multi star power");
            Destroy(instantiatedPressedMultiStarPowerButton);
        }

        else if (!currentStates.GetMultiStarPowerPressed() && hit != null && hit.gameObject == gameObject && hit3 != null && hit3.gameObject == gameObject)
        {
            if (!GameObject.Find("Level Controller").GetComponent <RockLevelCheckForMatches> ().GetGameStarted())
            {
                Destroy(instantiatedPressedMultiStarPowerButton);
                return;
            }

            GameObject.Find("Level Controller").GetComponent <RockLevelInstantiator> ().IncreaseJewelCollectorDifficultyPercentage(.05f);
            powerPercentageController.IncreasePecentage(10);
            powerPercentageController.IncreaseJewelDropPercentage(10);
            powerPercentageController.IncreaseBombColorDropPercentage(10);
            GameObject.Find("Level Controller").GetComponent <RockLevelSwapJewel> ().SetFirstSwapPerformed(true);
            GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetFirstMoveMade(true);
            soundHandler.PlayButtonClickUp();
//			launchStars = true;
//			launchStarCount += 5;
            GameObject temp;
            for (int i = 0; i < 5; i++)
            {
                temp = (GameObject)Instantiate(GetRandomHomingStar(), new Vector3(transform.position.x, transform.position.y, transform.position.z + 5), Quaternion.identity);
                temp.GetComponent <RockLevelHomingStarMovement> ().SetRow(Random.Range(0, 9));
                temp.GetComponent <RockLevelHomingStarMovement> ().SetCol(Random.Range(0, 9));
            }
            currentStates.SetMultiStarPowerPressed(true);
            GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetPurchaseMade(true);
            StoreInventory.TakeItem("coin_currency_ID", 250);
//			coinTotalManager.UpdateCoinNumber ();
            if (instantiatedCoinNumberOne != null)
            {
                instantiatedCoinNumberOne.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            if (instantiatedCoinNumberTwo != null)
            {
                instantiatedCoinNumberTwo.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            if (instantiatedCoinNumberThree != null)
            {
                instantiatedCoinNumberThree.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            numbersSentHome = true;
        }
    }
Example #2
0
    void CheckTouch3(Vector3 pos)
    {
        Vector3 wp       = Camera.main.ScreenToWorldPoint(pos);
        Vector2 touchPos = new Vector2(wp.x, wp.y);

        hit3 = Physics2D.OverlapPoint(touchPos);

        if (hit != null && hit.gameObject == gameObject && hit3 != null && hit3.gameObject == gameObject && StoreInventory.GetItemBalance("coin_currency_ID") < 1000)
        {
            //Debug.Log ("Not enough coins for jewel swap power");
            GameObject.Find("Pause Button(Clone)").GetComponent <PauseButtonHandler> ().PauseGameRemotely();
            GameObject.Find("Screen Handlers").GetComponent <PurchaseCoinsScreenHandler> ().InstantiateCameraOffsetScreen();
            soundHandler.PlayButtonClickUp();
            Destroy(instantiatedPressedJewelSwapButton);
        }

        else if (hit != null && hit.gameObject == gameObject && hit3 != null && hit3.gameObject == gameObject)
        {
            if (!GameObject.Find("Level Controller").GetComponent <RockLevelCheckForMatches> ().GetGameStarted())
            {
                Destroy(instantiatedPressedJewelSwapButton);
                return;
            }

            GameObject.Find("Level Controller").GetComponent <RockLevelInstantiator> ().IncreaseJewelCollectorDifficultyPercentage(.1f);
            powerPercentageController.IncreasePecentage(10);
            powerPercentageController.IncreaseJewelDropPercentage(10);
            powerPercentageController.IncreaseBombColorDropPercentage(10);
            GameObject.Find("Level Controller").GetComponent <RockLevelSwapJewel> ().SetFirstSwapPerformed(true);
            GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetFirstMoveMade(true);
            soundHandler.PlayButtonClickUp();
            soundHandler.PlayHandbrake();
            GameObject.Find("Level Controller").GetComponent <RockLevelShuffleGameBoard> ().ResetTheGameboard();
            currentStates.SetJewelSwapPowerPressed(true);
            GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetPurchaseMade(true);
            StoreInventory.TakeItem("coin_currency_ID", 1000);
//			coinTotalManager.UpdateCoinNumber ();
            if (instantiatedCoinNumberOne != null)
            {
                instantiatedCoinNumberOne.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            if (instantiatedCoinNumberTwo != null)
            {
                instantiatedCoinNumberTwo.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            if (instantiatedCoinNumberThree != null)
            {
                instantiatedCoinNumberThree.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            if (instantiatedThousanthCoin != null)
            {
                instantiatedThousanthCoin.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            numbersSentHome = true;
        }
    }
    void CheckTouch3(Vector3 pos)
    {
        Vector3 wp       = Camera.main.ScreenToWorldPoint(pos);
        Vector2 touchPos = new Vector2(wp.x, wp.y);

        hit3 = Physics2D.OverlapPoint(touchPos);
        if (hit != null && hit.gameObject == gameObject && hit3 != null && hit3.gameObject == gameObject && StoreInventory.GetItemBalance("coin_currency_ID") < 5000)
        {
            soundHandler.PlayButtonClickUp();
            GameObject.Find("Pause Button(Clone)").GetComponent <PauseButtonHandler> ().PauseGameRemotely();
            GameObject.Find("Screen Handlers").GetComponent <PurchaseCoinsScreenHandler> ().InstantiateCameraOffsetScreen();
            //Debug.Log ("Not enough coins for single star power");
            Destroy(instantiatedPressedPlusFivePowerButton);
        }

        else if (!currentStates.GetPlusFivePowerPressed() && hit != null && hit.gameObject == gameObject && hit3 != null && hit3.gameObject == gameObject)
        {
            if (!GameObject.Find("Level Controller").GetComponent <RockLevelCheckForMatches> ().GetGameStarted())
            {
                Destroy(instantiatedPressedPlusFivePowerButton);
                return;
            }

            GameObject.Find("Level Controller").GetComponent <RockLevelInstantiator> ().IncreaseJewelCollectorDifficultyPercentage(.1f);
            powerPercentageController.IncreasePecentage(10);
            powerPercentageController.IncreaseJewelDropPercentage(10);
            powerPercentageController.IncreaseBombColorDropPercentage(10);
            GameObject.Find("Level Controller").GetComponent <RockLevelSwapJewel> ().SetFirstSwapPerformed(true);
            GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetFirstMoveMade(true);
            soundHandler.PlayButtonClickUp();
            soundHandler.PlayPowerUpSound();
//			GameObject tempObject;
//			tempObject = (GameObject)Instantiate (GetRandomFallingStar (), new Vector3 (transform.position.x, transform.position.y, transform.position.z + 1), Quaternion.identity);
//			PaidPowerTracker.AddPowerToList (tempObject);
            currentStates.SetPlusFivePowerPressed(true);
            GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetPurchaseMade(true);
            StoreInventory.TakeItem("coin_currency_ID", 5000);
            if (GameObject.Find("Jewel Collector") != null)
            {
                GameObject.Find("Jewel Collector").GetComponent <MoveNumberHandler> ().AddFiveToMoveNumber();
            }
            else
            {
                GameObject.Find("Level Controller").GetComponent <RockLevelBombHandler> ().AddFiveToAllBombs();
            }
            //			coinTotalManager.UpdateCoinNumber ();
            if (instantiatedThousanthCoin != null)
            {
                instantiatedThousanthCoin.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            if (instantiatedCoinNumberOne != null)
            {
                instantiatedCoinNumberOne.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            if (instantiatedCoinNumberTwo != null)
            {
                instantiatedCoinNumberTwo.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            if (instantiatedCoinNumberThree != null)
            {
                instantiatedCoinNumberThree.GetComponent <PowerCoinNumberMovementController> ().MoveNumberBack(true);
            }
            numbersSentHome = true;
        }
    }