//Тест лужи мочи void TestPiiWater() { if (player != null) { //Если нужно поднимать if (player.gameplayParametrs.get_lvl_now() < 2) { //узнаем в процентах настоящий предел float percent_now = 0; if (player.ScoreALL > points_start) { percent_now = ((player.ScoreALL - points_start) / points_max); } else { percent_now = 0; } //узнали теперь считаем нужную высоту и применяем ее Vector3 position_now = gameObject.transform.position; position_now.y = start_pos_y + (plus_max * percent_now); position_now.y = gameObject.transform.position.y + (position_now.y - gameObject.transform.position.y) / 20; if (player.ScoreTime > points_max && Wall != null) { Wall.DestroyWall(); } gameObject.transform.position = position_now; if (material != null) { Vector2 pos_tex = material.mainTextureOffset; pos_tex.y += 0.05f * Time.deltaTime; material.mainTextureOffset = pos_tex; } } //Иначе если нужен спуск else if (start_pos_y != gameObject.transform.position.y) { //Уменьшаем плавно Vector3 position_now = gameObject.transform.position; position_now.y -= 0.1f * Time.deltaTime; if (position_now.y < start_pos_y) { position_now.y = start_pos_y; } gameObject.transform.position = position_now; if (material != null) { Vector2 pos_tex = material.mainTextureOffset; pos_tex.y += 0.5f * Time.deltaTime; material.mainTextureOffset = pos_tex; } } } }
public void DestroyWall() { if (!CrashWall_yn) { CrashWall_yn = true; //Ломаем for (int num_now = 0; num_now < targets.Length; num_now++) { //targets[num_now].gameObject.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.None; if (targets[num_now].heath > 0) { targets[num_now].heath = 0; targets[num_now].gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None; } } //Если игрок есть то говорим ему передвигаться на позицию if (player != null) { player.move_to_3(); } if (gameObject.GetComponent <AudioSource>() != null && clipDestroy != null && seting != null) { AudioSource audioSource = gameObject.GetComponent <AudioSource>(); audioSource.volume = seting.game.volume_all * seting.game.volume_sound; audioSource.PlayOneShot(clipDestroy); } if (wallTargetDestroy != null) { wallTargetDestroy.DestroyWall(); } //if (lvl_Text != null && text_destroy != null) { // lvl_Text.text_next = text_destroy; //} if (gameplayParametrs != null) { gameplayParametrs.start_lvl_2(); } } }