예제 #1
0
파일: GlassBall.cs 프로젝트: gbudiman/glass
    void UpdatePowerUpMeterOverNetwork()
    {
        if (powerup_meter == null)
        {
            powerup_meter = GameObject.FindObjectOfType <PowerupMeter>();
        }

        powerup_meter.Add();
    }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     animator      = GetComponentInChildren <Animator>();
     powerup_ui    = transform.parent.GetComponentInChildren <PowerUpUI>();
     powerup_meter = GameObject.FindObjectOfType <PowerupMeter>();
     gd            = GameObject.FindObjectOfType <GestureDetector>();
     InitializeCooldownMeter();
     InitializeBouncers();
 }
예제 #3
0
파일: GlassBall.cs 프로젝트: gbudiman/glass
 void Start()
 {
     powerup_meter          = GameObject.FindObjectOfType <PowerupMeter>();
     movement_vector_scaler = INITIAL_MAGNITUDE_SCALER;
     wcl               = GameObject.FindObjectOfType <WallController>();
     photon_view       = GetComponent <PhotonView>();
     breakshot         = GameObject.FindObjectOfType <Breakshot>();
     audio_source      = GetComponent <AudioSource>();
     audio_source.clip = balls_bounce;
 }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        audio_source      = GetComponent <AudioSource>();
        audio_source.clip = click_clip;
        touch_detection   = GameObject.FindObjectOfType <TouchDetection>();
        gesture_detector  = GameObject.FindObjectOfType <GestureDetector>();
        game_manager      = GameObject.FindObjectOfType <GlassGameManager>();
        powerup_manager   = GameObject.FindObjectOfType <PowerUpManager>();
        sprite_renderer   = GetComponentInChildren <SpriteRenderer>();
        powerup_meter     = GameObject.FindObjectOfType <PowerupMeter>();

        touch_detection.DisableForNextGesture(true);
        gesture_detector.DisableTemporarily(true);
        guide_text       = guide_text_object.GetComponent <Text>();
        guide_text.color = new Color(guide_text.color.r, guide_text.color.g, guide_text.color.b, 0);
        guide_text.text  = "Let's learn about Power Up";
        state            = State.fading_in;
        stage            = Stage.intro;
        stage_elapsed    = stage_interval;
        next_button.SetActive(false);
        quit_button.SetActive(false);
        touch_detection.DisableForNextGesture(true);
        powerup_manager.DisableAllPowerUp();
        sprite_renderer.enabled = false;

        // Fast jump for test mode
        //stage = Stage.supercharge_intro_3;
        //state = State.fading_out;
        //game_manager.InitializeBreakshot();
        //game_manager.InitializePowerUpSpawner();
        //touch_detection.DisableForNextGesture(false);
        //gesture_detector.DisableTemporarily(false);
        //PowerUpSpawner powerup_spawner = GameObject.FindObjectOfType<PowerUpSpawner>();
        //powerup_spawner.enabled = false;
        //foreach (PowerupCalculator puc in GameObject.FindObjectsOfType<PowerupCalculator>()) {
        //  Destroy(puc.gameObject);
        //}
    }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     powerup_ui          = GameObject.FindObjectOfType <PowerUpUI>();
     powerup_meter       = GameObject.FindObjectOfType <PowerupMeter>();
     next_is_triple_shot = false;
 }
예제 #6
0
 //bool swipe_queued = false;
 //PowerUpElement pel;
 // Use this for initialization
 void Start()
 {
     pum           = GetComponentInParent <PowerUpManager>();
     powerup_meter = GameObject.FindObjectOfType <PowerupMeter>();
     animator      = background.GetComponent <Animator> ();
 }
예제 #7
0
    void DetectSwipe()
    {
        if (temporarily_disabled)
        {
            return;
        }
        float pos_x = Camera.main.ScreenToWorldPoint(Input.mousePosition).x;
        float pos_y = Camera.main.ScreenToWorldPoint(Input.mousePosition).y;

        if (powerup_meter == null)
        {
            powerup_meter = GameObject.FindObjectOfType <PowerupMeter>();
        }

        // Swipe location is determined by the first contact
        SwipeLocation  swipe_location  = DetectSwipeLocation();
        SwipeDirection swipe_direction = DetectSwipeDirection(pos_x, pos_y);

        print(swipe_direction + " | " + swipe_location);

        if (swipe_location == SwipeLocation.on_else)
        {
            switch (swipe_direction)
            {
            case SwipeDirection.swipe_up: pum.TripleShot(); break;

            case SwipeDirection.swipe_down: pum.ActivateSafetyNet(); break;

            case SwipeDirection.swipe_left:
            case SwipeDirection.swipe_right:
                bool inverse = PhotonNetwork.connected && PhotonNetwork.isMasterClient;

                SwipeDirection actual_swipe = swipe_direction;
                if (inverse)
                {
                    switch (swipe_direction)
                    {
                    case SwipeDirection.swipe_left:
                        actual_swipe = SwipeDirection.swipe_right;
                        break;

                    case SwipeDirection.swipe_right:
                        actual_swipe = SwipeDirection.swipe_left;
                        break;
                    }
                }

                if (powerup_meter.TestSubtract(2))
                {
                    if (!inverse && actual_swipe == SwipeDirection.swipe_right ||
                        inverse && actual_swipe == SwipeDirection.swipe_left)
                    {
                        animator.SetBool("isSliding", true);
                        animator.SetBool("isSlidingRight", true);
                    }
                    else
                    {
                        animator.SetBool("isSliding", true);
                        animator.SetBool("isSlidingRight", false);
                    }
                    pum.SuperchargeWall(actual_swipe); break;
                }

                break;
            }
        }
        //if (swipe != SwipeDirection.no_swipe) {
        //  //print("on callback");
        //  //pel.OnSwipeDetected(swipe);
        //  touch_detection.DisableForNextGesture(false);
        //}
    }
예제 #8
0
 public void RegisterPowerupMeter(PowerupMeter _pm)
 {
     pm = _pm;
 }
예제 #9
0
    void InitializePowerUpManager()
    {
        PowerupMeter pm = GameObject.FindObjectOfType <PowerupMeter>();

        GetComponent <PowerUpManager>().RegisterPowerupMeter(pm);
    }
예제 #10
0
 // Use this for initialization
 void Start()
 {
     animator      = GetComponentInParent <Animator>();
     powerup_meter = GameObject.FindObjectOfType <PowerupMeter>();
     show_power_up = false;
 }