Ejemplo n.º 1
0
    // 当たり判定
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Object") || collision.gameObject.CompareTag("Block") || collision.gameObject.CompareTag("Fragment"))
        {
            GameObject root = null;
            // collisionの親を取得
            root = collision.transform.gameObject;

            // ディレクターから範囲内のオブジェクトを取得する
            Cube[] cubes = generator.GetCubeInRange(4.5f, this.transform.position);

            // もらったオブジェクトを爆発させる
            foreach (var c in cubes)
            {
                c.ExplodeMe(2000f, this.transform.position, 30f);
            }
            // 爆発音を再生
            audioSource.PlayOneShot(clip);
            if (cubes.Length > 0)
            {
                //// オブジェクトの分離処理
                spritter.CheckSplit(root);
            }
            Destroy(this.gameObject);
        }
    }
Ejemplo n.º 2
0
 void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.CompareTag("Object") || col.gameObject.CompareTag("Block") || col.gameObject.CompareTag("Fragment"))
     {
         // ディレクターから範囲内のオブジェクトを取得する
         Cube[] cubes = generator.GetCubeInRange(3.0f, this.transform.position);
         // もらったオブジェクトを爆発させる
         foreach (var c in cubes)
         {
             c.ExplodeMe(1000f, this.transform.position, 10f);
         }
         Destroy(this.gameObject);
     }
 }