コード例 #1
0
ファイル: wall.cs プロジェクト: canvasgames/MusicRushV2
    void show_me()
    {
        if (USER.s.FIRST_WALL_CREATED == 0)
        {
            USER.s.FIRST_WALL_CREATED = 1;
            PlayerPrefs.SetInt("first_wall_created", 1);
        }

//		if (globals.s.PW_SIGHT_BEYOND_SIGHT)
//			my_vision_effect.SetActive (false);

        //Debug.Log("\n NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN SCALE ME UP! DIST: " + Mathf.Abs(transform.position.x - globals.s.BALL_X) );
        //transform.GetComponent<SpriteRenderer>().color = new Color32(0, 0, 0, 0);
        already_appeared = true;
        my_skin.transform.DOScaleY(1f, 0.2f);

        sound_controller.s.PlaySfxTrapHiddenWallAppear();

        if (spike_trigger)
        {
//            spike[] spks = FindObjectsOfType(typeof(spike)) as spike[];
            spike[] spks = objects_pool_controller.s.spikes_scripts.ToArray();


            for (int i = 0; i < spks.Length; i++)
            {
                spks[i].show_me_by_floor(my_floor);
            }
        }

        if (wall_trigger)
        {
            my_twin_wall.trigger_back = true;
            wall_trigger = false;
            my_twin_wall.GetComponent <BoxCollider2D>().enabled = true;
        }
        else if (trigger_back)
        {
            my_twin_wall.unshow_me();
        }

        /*
         * gameObject spk = FindObjectOfType<spike>.GetComponent("spike");
         * // Initialize Globals singleton
         * globals[] single2 = FindObjectsOfType(typeof(globals)) as globals[];
         * if (single2.Length == 0)
         * {
         * GameObject obj = (GameObject)Instantiate(single, new Vector3(0, 0, 0), transform.rotation);
         * globals final = obj.GetComponent<globals>();
         * }*/
    }
コード例 #2
0
    bool B_DoubleWall(int n)
    {
        wave_name = "shard_double_wall";

        bool there_is_manual = false;

        CreateNormalFloor("doubleWall_veryHard", n);

        float rand_x = Random.Range(-center_mid_area, center_mid_area);
        //spike, located at middle
        int rand = Random.Range(1, 100);

        if (rand < 40)
        {
            game_controller.s.create_spike(rand_x, actual_y, n);
        }
        else if (rand < 65)
        {
            game_controller.s.create_hidden_spike(rand_x, actual_y, n);
        }
        else
        {
            game_controller.s.create_hidden_spike(rand_x, actual_y, n, true);
            there_is_manual = true;
        }

        //second spike, manually triggered located at the opposite corner of the wall
        float rand_x2 = Random.Range(corner_right - 1.3f, corner_right);

        // WALL TWEEN LOGIC
        wall w1 = game_controller.s.create_wall_corner(n, there_is_manual);

        wall w2 = game_controller.s.create_wall_corner(n, false);

        w1.my_twin_wall = w2;
        w2.my_twin_wall = w1;

        w1.wall_trigger           = true;
        w2.wall_triggered_by_wall = true;
        w2.GetComponent <BoxCollider2D>().enabled = false;

        last_spike_right = false;
        last_spike_left  = false;
        last_wall        = true;
        last_hole        = false;
        return(true);
    }