コード例 #1
0
ファイル: WallTarget.cs プロジェクト: koker007/PiiSim_test1
    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();
            }
        }
    }