public void CreateSafePlatform() { cur_cube_coord = init_cude.transform.position; for (int i = 0; i < platform.childCount; ++i) { Destroy(platform.GetChild(i).gameObject); } GameObject go1 = (GameObject)Instantiate(Resources.Load(platform_item_prefab_path)); go1.transform.parent = platform; go1.transform.position = new Vector3(cur_cube_coord.x, cur_cube_coord.y, cur_cube_coord.z + 1); init_cude = go1; for (int i = 0; i < 21; ++i) { init_cude = CreateLineSafe(init_cude, true); cur_cube_coord = init_cude.transform.position; GameObject go = (GameObject)Instantiate(Resources.Load(platform_item_prefab_path)); go.transform.parent = platform; go.transform.position = new Vector3(cur_cube_coord.x + i, cur_cube_coord.y, cur_cube_coord.z - 1); init_cude = go; } init_cude = go1; go1 = (GameObject)Instantiate(Resources.Load(platform_item_prefab_path)); go1.transform.parent = platform; go1.transform.position = new Vector3(init_cude.transform.position.x, init_cude.transform.position.y, init_cude.transform.position.z + 1); init_cude = go1; Message msg = new Message(); msg.Type = Minigames.MiniGameMessageType.UPDATE_INIT_POS; msg.parametrs = new Minigames.UpdateInitPos(init_cude.transform); MessageBus.Instance.SendMessage(msg); if (cur_strategy.id != 1) { cur_strategy.SetInitOffset(cur_strategy.offset - 1); } else { cur_strategy.SetInitOffset(cur_strategy.offset); } }
public void LoadStartPlatform() { var go = GameObject.Find("env_new_zigzag").transform.Find("lc_mngm_001"); driving_platform_material1 = go.Find("waterfront_001 (1)").GetComponent <Renderer>().material; offset1 = driving_platform_material1.GetTextureOffset("_MainTex"); driving_platform_material2 = go.Find("waterfront_001").GetComponent <Renderer>().material; offset2 = driving_platform_material2.GetTextureOffset("_MainTex"); trees_left = go.Find("left_set").gameObject; trees_right = go.Find("right_set").gameObject; PLATFORM_SPEED = 1.5f; cur_strategy = item3x3; cur_strategy.SetInitOffset(cur_strategy.offset - 1); CUBE_RESP_TIME_FACTOR = 1; //cur_strategy = item2x2; //cur_strategy.SetInitOffset(cur_strategy.offset - 1); platform = ((GameObject)Instantiate(Resources.Load(platform_prefab_path))).transform; init_cude = platform.Find("level_particle_init").gameObject; Message msg = new Message(); msg.Type = Minigames.MiniGameMessageType.INIT_PLATFORM; msg.parametrs = new Minigames.UpdateInitPos(platform.transform); MessageBus.Instance.SendMessage(msg); }
public void UpDifficult() { if (cur_strategy == item3x3) { cur_strategy = item2x2; } else if (cur_strategy == item2x2) { cur_strategy = item1x1; cur_strategy.SetInitOffset(cur_strategy.offset + 1); } }