示例#1
0
 void OnTriggerEnter(Collider collider)
 {
     piece_obj    = GameObject.Find("peace"); //変数名変えよう
     piece_script = piece_obj.GetComponent <move_peace>();
     //if (field_script.set_flag != false)
     {
         if (gameObject.tag == "floor" || gameObject.tag == "block")
         {
             Debug.Log(collider.gameObject.tag);
             if (collider.gameObject.tag == "dummy0")
             {
                 field_script.set_cube(GameObject.Find("peace"));
             }
         }
         else if (gameObject.tag == "kabe")
         {
             if (collider.gameObject.tag == "dummy1")
             {
                 //Debug.Log("あたった");
                 piece_script.right_move_flag = true;
             }
             if (collider.gameObject.tag == "dummy2")
             {
                 piece_script.left_move_flag = true;
             }
             if (collider.gameObject.tag == "dummy3")
             {
                 //Debug.Log("あたった");
                 piece_script.back_move_flag = true;
             }
             if (collider.gameObject.tag == "dummy4")
             {
                 piece_script.forward_move_flag = true;
             }
             if (collider.gameObject.tag == "dummy5")
             {
                 piece_script.left_rot_flag = true;
             }
             if (collider.gameObject.tag == "dummy6")
             {
                 piece_script.back_rot_flag = true;
             }
             if (collider.gameObject.tag == "dummy7")
             {
                 piece_script.forward_rot_flag = true;
             }
             if (collider.gameObject.tag == "dummy8")
             {
                 piece_script.right_rot_flag = true;
             }
         }
     }
 }
示例#2
0
 void OnTriggerEnter(Collider collider)
 {
     piece_obj    = GameObject.Find("peace"); //変数名変えよう
     ghost_obj    = GameObject.Find("ghost");
     se_obj       = GameObject.Find("SE");
     piece_script = piece_obj.GetComponent <move_peace>();
     if (ghost_obj != null)
     {
         ghost_script = ghost_obj.GetComponent <move_ghost>();
     }
     //if (field_script.set_flag != false)
     {
         if (gameObject.tag == "floor" || gameObject.tag == "block")
         {
             //Debug.Log(collider.gameObject.tag);
             if (collider.gameObject.tag == "dummy0")
             {
                 se_obj.GetComponent <AudioSource>().PlayOneShot(piece_script.soundlist[0]);
                 piece_script.move_flag = true;
                 field_script.set_cube(GameObject.Find("peace"));
             }
             if (ghost_obj != null)
             {
                 if (collider.gameObject.tag == "ghost" && ghost_script.move_flag == false)
                 {
                     ghost_script.move_flag        = true;
                     ghost_obj.transform.position += Vector3.up;
                 }
             }
         }
         else if (gameObject.tag == "kabe")
         {
             if (collider.gameObject.tag == "dummy1")
             {
                 //Debug.Log("あたった");
                 piece_script.right_move_flag = true;
             }
             if (collider.gameObject.tag == "dummy2")
             {
                 piece_script.left_move_flag = true;
             }
             if (collider.gameObject.tag == "dummy3")
             {
                 //Debug.Log("あたった");
                 piece_script.back_move_flag = true;
             }
             if (collider.gameObject.tag == "dummy4")
             {
                 piece_script.forward_move_flag = true;
             }
             if (collider.gameObject.tag == "dummy5")
             {
                 piece_script.left_rot_flag = true;
             }
             if (collider.gameObject.tag == "dummy6")
             {
                 piece_script.back_rot_flag = true;
             }
             if (collider.gameObject.tag == "dummy7")
             {
                 piece_script.forward_rot_flag = true;
             }
             if (collider.gameObject.tag == "dummy8")
             {
                 piece_script.right_rot_flag = true;
             }
         }
         else if (gameObject.tag == "gen")
         {
             if (collider.gameObject.tag == "piece")
             {
                 Debug.Log("gen 通過");
                 if (piece_script.move_flag == true)
                 {
                     if (field_script.create_flag == false)
                     {
                         field_script.create_flag = true;
                         Debug.Log("Gameover");
                         SceneManager.LoadScene("GameOver");
                     }
                 }
             }
         }
     }
 }