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") < 500)
        {
            soundHandler.PlayButtonClickUp();
            GameObject.Find("Pause Button(Clone)").GetComponent <PauseButtonHandler> ().PauseGameRemotely();
            GameObject.Find("Screen Handlers").GetComponent <PurchaseCoinsScreenHandler> ().InstantiateCameraOffsetScreen();
            //Debug.Log ("Not enough coins for bomb power");
            Destroy(instantiatedPressedBombPowerButton);
        }

        else if (!currentStates.GetBombPowerPressed() && hit != null && hit.gameObject == gameObject && hit3 != null && hit3.gameObject == gameObject)
        {
            if (!GameObject.Find("Level Controller").GetComponent <RockLevelCheckForMatches> ().GetGameStarted())
            {
                Destroy(instantiatedPressedBombPowerButton);
                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();
            soundHandler.PlayPowerUpSound();
            GameObject tempObject;
            tempObject = (GameObject)Instantiate(GetRandomFallingBomb(), new Vector3(transform.position.x, transform.position.y, transform.position.z + 1), Quaternion.identity);
            PaidPowerTracker.AddPowerToList(tempObject);
//			tempObject.GetComponent<HomingBombMovementController> ().SetTargetRowAndCol (Random.Range (1, 8), Random.Range (1, 8));
            currentStates.SetBombPowerPressed(true);
            GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetPurchaseMade(true);
            StoreInventory.TakeItem("coin_currency_ID", 500);
//			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;
        }
    }
 // Update is called once per frame
 void FixedUpdate()
 {
     if (launchRowDestructionStars && Time.time > timestamp + cooldown && moveNumberTotal > 0)
     {
         timestamp = Time.time;
         instantiatedRowDestructionStar = (GameObject)Instantiate(GetRandomRowDestructionStar(), rowDestructionPosition, Quaternion.identity);
         PaidPowerTracker.AddPowerToList(instantiatedRowDestructionStar);
         SubtractOneFromMoveNumber();
     }
     else if (launchRowDestructionStars && moveNumberTotal <= 0)
     {
         finishedLaunching = true;
     }
 }
 void InstantiateRowDestructionStar()
 {
     PaidPowerTracker.AddPowerToList((GameObject)Instantiate(GetRandomRowDestructionStar(), starStartingPosition, Quaternion.identity));
 }
 void InstantiateFallingBomb()
 {
     PaidPowerTracker.AddPowerToList((GameObject)Instantiate(GetRandomFallingBomb(), starStartingPosition, Quaternion.identity));
 }