コード例 #1
0
ファイル: GlassBall.cs プロジェクト: gbudiman/glass
    void UpdatePowerUpMeterOverNetwork()
    {
        if (powerup_meter == null)
        {
            powerup_meter = GameObject.FindObjectOfType <PowerupMeter>();
        }

        powerup_meter.Add();
    }
コード例 #2
0
ファイル: PowerUpElement.cs プロジェクト: gbudiman/glass
 // 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;
 }