/// <summary> /// 軸にするオブジェクトと同じ親のオブジェクトを取得 /// </summary> private void Get_Children() { //回転の中心にするオブジェクト取得 (g_center_Ver, g_center_Side, g_center_High) = g_center_Dice.GetComponent <Dice_Squares>().Get_Dice_Pointer(); //回転の軸の親オブジェクト取得 g_parent_center_Dice = g_center_Dice.transform.parent.gameObject; //親スクリプト取得 g_parent_Script = g_parent_center_Dice.GetComponent <Parent_Dice>(); //親の子オブジェクトを格納した配列を取得 g_work_children = g_parent_Script.Get_Children(); }
/// <summary> /// 接触したサイコロ同士の接触面を比較し接着するか調べる処理 /// </summary> private void Docking_Check() { //移動側のサイコロの接触面に対応した処理をする switch (g_adhesive_para) { //接触面が縦のプラス方向の時 case g_ver_plus_para: //停止側のパラメータを縦のマイナス方向のパラメータにする g_next_adhesive_para = g_ver_minus_para; break; //接触面が縦のマイナス方向の時 case g_ver_minus_para: //停止側のパラメータを縦のプラス方向のパラメータにする g_next_adhesive_para = g_ver_plus_para; break; //接触面が横のプラス方向の時 case g_side_plus_para: //停止側のパラメータを横のマイナス方向のパラメータにする g_next_adhesive_para = g_side_minus_para; break; //接触面が横のマイナス方向の時 case g_side_minus_para: //停止側のパラメータを横のプラス方向のパラメータにする g_next_adhesive_para = g_side_plus_para; break; //接触面が高さのプラス方向の時 case g_high_plus_para: //停止側のパラメータを高さのマイナス方向のパラメータにする g_next_adhesive_para = g_high_minus_para; break; //接触面が高さのマイナス方向の時 case g_high_minus_para: //停止側のパラメータを高さのプラス方向のパラメータにする g_next_adhesive_para = g_high_plus_para; break; } //接触した側の接触面の数値を取得 int g_dice_squares = g_dice_Obj.GetComponent <Dice_Squares>().Get_Array_Squares(g_adhesive_para); //接触された側の接触面の数値を取得 int g_next_dice_squares = g_next_dice_Script.Get_Array_Squares(g_next_adhesive_para); //互いの数値の合計が7の時くっつく if (g_dice_squares + g_next_dice_squares == g_max_squares_sum) { //操作中オブジェクトの親を取得 GameObject parent_Obj = g_dice_Obj.gameObject.transform.root.gameObject; //くっつけられた側の親オブジェクトを保持 GameObject detroy_Obj = g_next_dice_Obj.transform.parent.gameObject; //くっつけられた側の親のスクリプト取得 Parent_Dice next_parent_Script = g_next_dice_Obj.transform.parent.GetComponent <Parent_Dice>(); //くっつけられた側の子オブジェクトをすべて取得 GameObject[] children = next_parent_Script.Get_Children(); //くっつける前の子の数 int children_count = parent_Obj.GetComponent <Parent_Dice>().Get_Children_Count(); parent_Obj.GetComponent <Parent_Dice>().Parent_In_Child(children); int plus_count = next_parent_Script.Get_Children_Count(); //くっつけた後の子の数 int next_children_count = parent_Obj.GetComponent <Parent_Dice>().Get_Children_Count(); //くっつけた後の子の個数がくっつける前より増えていたら if (next_children_count > children_count) { //くっつくSEを再生 g_se_source_Script.Se_Play(1); //くっついた面からパーティクル生成 g_particle_Script.Docking_Particle_Play(g_dice_Obj, g_now_check_pointer); } } }