Example #1
0
    public void SuperchargeWall(GestureDetector.SwipeDirection swipe)
    {
        int cost = 1;

        if (bouncer_left == null)
        {
            InitializeBouncers();
        }

        if (!ENABLE_CONSTRAINT || pm.TestSubtract(cost) && allow_supercharge)
        {
            pm.ExecuteSubtract(cost);
            audio_source.PlayOneShot(clip_wall_supercharged);
            bool successful_swipe = false;
            switch (swipe)
            {
            case GestureDetector.SwipeDirection.swipe_right:
                bouncer_right.SetSupercharge(SUPERCHARGE_BASE_TIME);
                successful_swipe = true;
                break;

            case GestureDetector.SwipeDirection.swipe_left:
                bouncer_left.SetSupercharge(SUPERCHARGE_BASE_TIME);
                successful_swipe = true;
                break;
            }

            if (tutorial_power_up != null && successful_swipe)
            {
                tutorial_power_up.ProceedSupercharge();
            }
        }
    }
Example #2
0
    void DetectMousePosition()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector3 mouse_position = Input.mousePosition;
            mouse_position.z = Camera.main.transform.position.z;
            mouse_position   = Camera.main.ScreenToWorldPoint(mouse_position);

            //if (mouse_position.y > 0) { return; }
            if (powerup_ui.UIIsVisible && mouse_position.y > 4)
            {
                return;
            }
            GameObject ball_object;
            if (PhotonNetwork.connected)
            {
                ball_object = PhotonNetwork.Instantiate(glass_ball_prefab.name, transform.position, Quaternion.identity, 0) as GameObject;
            }
            else
            {
                ball_object = Instantiate(glass_ball_prefab, transform.position, Quaternion.identity) as GameObject;
            }
            GlassBall glass_ball = ball_object.GetComponent <GlassBall> ();
            glass_ball.SetNormalForce(transform.position, mouse_position);

            if (next_is_triple_shot)
            {
                //if (true) {
                powerup_meter.ExecuteSubtract(3);
                glass_ball.SetTripleShot();
                next_is_triple_shot = false;
            }
        }
    }