예제 #1
0
    IEnumerator Reset()
    {
        K = 0;
        Lighting.SetActive(false);
        Wick.SendMessage("Reset");
        B2.layer      = 15;
        Btr1.position = Pos - Scale * new Vector3(2.2f, 0.0f, 0.0f);

        if (OutDirection.Equals(1))
        {
            Btr2.position = Pos + Scale * new Vector3(2.2f, 0.0f, 0.0f);

            //Rb.AddForce (new Vector3 (200.0f, 0, 0));
        }
        else if (OutDirection.Equals(2))
        {
            Btr2.position = Pos + Scale * new Vector3(0.0f, 2.2f, 0.0f);

            ///Rb.AddForce (new Vector2 (0.0f, 200.0f));
        }
        else if (OutDirection.Equals(4))
        {
            Btr2.position = Pos + Scale * new Vector3(0.0f, -2.2f, 0.0f);

            //Rb.AddForce (new Vector2 (0.0f, -200.0f));
        }
        //if (bulbOn) {
        bulbOn    = false;
        Tra1.time = 0.0f;
        Tra2.time = 0.0f;
        Rb1.Sleep();
        Rb2.Sleep();
        yield return(new WaitForSeconds(0.1f));

        B1.SetActive(false);
        B2.SetActive(false);
        for (int i = 0; i < 50; i++)
        {
            SS[i].color = new Color(0.0f, 0.0f, 0.0f, 1.0f);
        }
        First = true;
        //}
    }
예제 #2
0
 void OnTriggerExit2D(Collider2D col)
 {
     if (col.gameObject.Equals(B1) && !First)
     {
         B1.SetActive(false);
         B2.SetActive(true);
         Tra2.time = Mathf.Infinity;
         Lighting.SetActive(true);
         if (OutDirection.Equals(1))
         {
             Rb2.AddForce(V * new Vector2(200.0f, 0.0f));
         }
         else if (OutDirection.Equals(2))
         {
             Rb2.AddForce(V * new Vector2(0.0f, 200.0f));
         }
         else if (OutDirection.Equals(4))
         {
             Rb2.AddForce(V * new Vector2(0.0f, -200.0f));
         }
         StartCoroutine("Effect");
     }
 }
예제 #3
0
 private void CbR2OnStatusUpdated(object sender, EventArgs eventArgs)
 {
     Rb2.SetColor(CbR2.BrushColor);
     UpdateValue();
 }
예제 #4
0
    void Direction()
    {
        Rb1.Sleep();
        Tra1.time = Mathf.Infinity;
        Rb2.Sleep();
        Tra2.time = Mathf.Infinity;
        Rb3.Sleep();
        Tra3.time = Mathf.Infinity;
        if (Direction1.Equals(1))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction1.Equals(2))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction1.Equals(3))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction1.Equals(4))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction1.Equals(8))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction1.Equals(7))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction1.Equals(6))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction1.Equals(5))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction1.Equals(9))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction1.Equals(10))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction1.Equals(11))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction1.Equals(12))
        {
            Tr1.position = Pos1;
            Rb1.AddForce(V * new Vector2(178.9869f, -89.24f));
        }



        if (Direction2.Equals(1))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction2.Equals(2))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction2.Equals(3))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction2.Equals(4))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction2.Equals(6))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction2.Equals(7))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction2.Equals(8))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction2.Equals(5))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction2.Equals(9))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction2.Equals(10))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction2.Equals(11))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction2.Equals(12))
        {
            Tr2.position = Pos2;
            Rb2.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction3.Equals(1))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction3.Equals(2))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction3.Equals(3))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction3.Equals(4))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction3.Equals(6))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction3.Equals(7))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction3.Equals(8))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction3.Equals(5))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction3.Equals(9))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction3.Equals(10))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction3.Equals(11))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction3.Equals(12))
        {
            Tr3.position = Pos3;
            Rb3.AddForce(V * new Vector2(178.9869f, -89.24f));
        }

        BaSc1.Direction = Direction1;
        BaSc2.Direction = Direction2;
        BaSc3.Direction = Direction3;
    }
예제 #5
0
        /// <summary>
        /// 按测段导出二等水准手簿
        /// </summary>
        /// <param name="excelApp">Excel对象</param>
        /// <param name="fileName">成果文件名</param>
        /// <param name="partInfo">测段对象</param>
        /// <param name="unitName">测量单位名称</param>
        private void part2Excel(Excel.Application excelApp, string fileName, PartInfo partInfo, string unitName)
        {
            string strExcelFile = Path.GetDirectoryName(Application.ExecutablePath) + @"\观测手簿模版.xlt";
            Excel.Workbook  excelWB = excelApp.Workbooks.Add(strExcelFile);
            Excel.Worksheet excelSheet = excelWB.Sheets[1];// 工作表

            excelSheet.Cells[2, 3].Value =unitName; // 单位名称

            // 获得测站数据范围和数据总结范围
            Excel.Range theRange, theRange1, theRange2;

            theRange1 = excelSheet.Range[excelSheet.Cells[7, 1], excelSheet.Cells[9, 10]]; // 测站数据范围
            theRange2 = excelSheet.Range[excelSheet.Cells[10, 1], excelSheet.Cells[14, 10]]; //线路汇总区域范围

            int n = partInfo.StationCount; // 测站数
            theRange2.Cut(excelSheet.Range[excelSheet.Cells[10 + (n - 1) * 3, 1], excelSheet.Cells[14 + (n - 1) * 3, 10]]); // 先剪切赋值线路汇总区域范围

            string fName0, bName0;// 开始已知点点名,结束已知点点名
            fName0= bName0="";
            string fName, bName;//前视点点名,后视点点名
            double bPtH, fPtH;//前视点高程,后视点高程
            bPtH = fPtH = 0.0;
            fName=bName="";
            double Rf1, Rf2, Rb1, Rb2;//中丝读数
            double deltRf, deltRb;//读数差
            double Df1, Df2, Db1, Db2;//前后视距
            double deltD;//视距差
            double deltH1, deltH2, deltH;//单次高差,平均高差
            
            double  SumdeltD=0.0;//累计视距差

            theRange1.Copy();
            // 开始赋值观测手簿
            for (int i = 0; i < n; i++)
            {
                Application.DoEvents();

                fName = partInfo.StationList[i].FPtName;
                bName =partInfo.StationList[i].BPtName;
                if (i == 0) bName0 = bName; // 开始点
                if (i == n-1) fName0 = fName; // 结束点’

                //中丝读数
                Rf1 = partInfo.StationList[i].Rf1;
                Rf2 = partInfo.StationList[i].Rf2;
                Rb1 = partInfo.StationList[i].Rb1;
                Rb2 = partInfo.StationList[i].Rb2;
                //读数差
                deltRf = Rf1 - Rf2;
                deltRb = Rb1 - Rb2;
                //高差及平均高差
                deltH1 = Rb1 - Rf1;
                deltH2 = Rb2 - Rf2;
                deltH = partInfo.StationList[i].DeltH;
                //前、后视点高程
                bPtH = partInfo.StationList[i].BPtH;
                fPtH = partInfo.StationList[i].FPtH;
                //视距
                Db1 = partInfo.StationList[i].Db1;
                Db2 = partInfo.StationList[i].Db2;
                Df1 = partInfo.StationList[i].Df1;
                Df2 = partInfo.StationList[i].Df2;
                deltD = partInfo.StationList[i].DeltD;
                SumdeltD = SumdeltD + deltD;

                theRange = excelSheet.Range[excelSheet.Cells[7 +i * 3, 1], excelSheet.Cells[9 + i * 3, 10]];
                theRange.PasteSpecial(Excel.XlPasteType.xlPasteFormats);

                excelSheet.Cells[7 + i * 3, 1].Value = i + 1; // 序号

                excelSheet.Cells[7 + i * 3, 2].Value = bName; // 后视点
                excelSheet.Cells[7 + i * 3 + 1, 2].Value = fName; // 前视点

                excelSheet.Cells[7 + i * 3, 3].Value = Db1.ToString("0.00000"); // 后视距1
                excelSheet.Cells[7 + i * 3 + 1, 3].Value = Df1.ToString("0.00000"); // 前视距1
                excelSheet.Cells[7 + i * 3 + 2, 3].Value = deltD.ToString("0.00000"); // 视距差

                excelSheet.Cells[7 + i * 3, 4].Value = Db2.ToString("0.00000"); // 后视距2
                excelSheet.Cells[7 + i * 3 + 1, 4].Value = Df2.ToString("0.00000"); // 前视距2
                excelSheet.Cells[7 + i * 3 + 2, 4].Value = SumdeltD.ToString("0.00000"); // 累计视距差

                excelSheet.Cells[7 + i * 3, 5].Value = Rb1.ToString("0.00000"); // 后视读数1
                excelSheet.Cells[7 + i * 3 + 1, 5].Value = Rf1.ToString("0.00000"); // 前视读数1
                excelSheet.Cells[7 + i * 3 + 2, 5].Value = deltH1.ToString("0.00000"); // 高差1

                excelSheet.Cells[7 + i * 3, 6].Value = Rb2.ToString("0.00000"); // 后视读数2
                excelSheet.Cells[7 + i * 3 + 1, 6].Value = Rf2.ToString("0.00000"); // 前视读数2
                excelSheet.Cells[7 + i * 3 + 2, 6].Value = deltH2.ToString("0.00000"); // 高差2

                excelSheet.Cells[7 + i * 3, 7].Value = (deltRb * 1000).ToString("0.00"); // 后视读数差
                excelSheet.Cells[7 + i * 3 + 1, 7].Value = (deltRf * 1000).ToString("0.00"); // 前视读数差
                excelSheet.Cells[7 + i * 3 + 2, 7].Value = ((deltH1 - deltH2) * 1000).ToString("0.00"); // 高差互差

                excelSheet.Cells[7 + i * 3 + 2, 8].Value = deltH.ToString("0.00000"); // 高差

                excelSheet.Cells[7 + i * 3, 9].Value = bPtH.ToString("0.00000"); // 后视点高程
                excelSheet.Cells[7 + i * 3 + 1, 9].Value = fPtH.ToString("0.00000"); // 前视点高程
            }//endfor

            excelSheet.Cells[10 + (n - 1) * 3, 3].Value = partInfo.StartPtName;//线路开始点名
            excelSheet.Cells[10 + (n - 1) * 3 + 1, 3].Value = partInfo.EndPtName; //线路结束点名
            excelSheet.Cells[10 + (n - 1) * 3 + 2, 3].Value = (partInfo.Df / 1000).ToString("0.00000"); // 累计前视距
            excelSheet.Cells[10 + (n - 1) * 3 + 3, 3].Value = (partInfo.Db / 1000).ToString("0.00000"); // 累计后视距

            excelSheet.Cells[10 + (n - 1) * 3 + 1, 6].Value = (partInfo.Db-partInfo.Df).ToString("0.00000"); // 累计视距差
            excelSheet.Cells[10 + (n - 1) * 3 + 2, 6].Value = partInfo.dz.ToString("0.00000"); // 累计高差
            excelSheet.Cells[10 + (n - 1) * 3 + 3, 6].Value = ((partInfo.Db + partInfo.Df )/ 1000).ToString("0.00000"); // 测段距离
            
            //合并单元格
            for (int i = 0; i <= n; i++)
            {
                theRange = excelSheet.Range[excelSheet.Cells[7 + i * 3, 1], excelSheet.Cells[9 + i * 3, 1]];
                theRange.Merge();
            }//endfor

             excelWB.SaveAs(fileName);//保存文件
             excelWB.Close();
        }
예제 #6
0
    IEnumerator Rexar(int Layer, Collider2D other)
    {
        B1.SetActive(true);
        Tr1.position = Pos1;
        B1.layer     = Layer;
        B1.GetComponent <Ball> ().Direction = Direction1;

        B2.SetActive(true);
        Tr2.position = Pos2;
        B2.layer     = Layer;
        B2.GetComponent <Ball> ().Direction = Direction2;
        //Rb2 = other.GetComponent<Rigidbody2D> ();
        B3.SetActive(true);
        Tr3.position = Pos3;
        B3.layer     = Layer;
        B3.GetComponent <Ball> ().Direction = Direction2;

        B4.SetActive(true);
        Tr4.position = Pos4;
        B4.layer     = Layer;
        B4.GetComponent <Ball> ().Direction = Direction2;

        B5.SetActive(true);
        Tr5.position = Pos5;
        B5.layer     = Layer;
        B5.GetComponent <Ball> ().Direction = Direction2;
        yield return(new WaitForSeconds(0.1f));

        Rb1.Sleep();
        B1.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb2.Sleep();
        B2.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb3.Sleep();
        B3.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb4.Sleep();
        B4.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb5.Sleep();
        B5.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Tr1.position = Pos1;
        Tr2.position = Pos2;
        Tr3.position = Pos3;
        Tr4.position = Pos4;
        Tr5.position = Pos5;



        if (Direction1.Equals(1))
        {
            Rb1.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction1.Equals(2))
        {
            Rb1.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction1.Equals(3))
        {
            Rb1.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction1.Equals(4))
        {
            Rb1.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction1.Equals(8))
        {
            Rb1.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction1.Equals(7))
        {
            Rb1.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction1.Equals(6))
        {
            Rb1.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction1.Equals(5))
        {
            Rb1.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction1.Equals(9))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction1.Equals(10))
        {
            Rb1.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction1.Equals(11))
        {
            Rb1.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction1.Equals(12))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction2.Equals(1))
        {
            Rb2.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction2.Equals(2))
        {
            Rb2.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction2.Equals(3))
        {
            Rb2.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction2.Equals(4))
        {
            Rb2.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction2.Equals(6))
        {
            Rb2.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction2.Equals(7))
        {
            Rb2.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction2.Equals(8))
        {
            Rb2.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction2.Equals(5))
        {
            Rb2.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction2.Equals(9))
        {
            Rb2.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction2.Equals(10))
        {
            Rb2.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction2.Equals(11))
        {
            Rb2.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction2.Equals(12))
        {
            Rb2.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction3.Equals(1))
        {
            Rb3.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction3.Equals(2))
        {
            Rb3.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction3.Equals(3))
        {
            Rb3.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction3.Equals(4))
        {
            Rb3.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction3.Equals(6))
        {
            Rb3.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction3.Equals(7))
        {
            Rb3.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction3.Equals(8))
        {
            Rb3.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction3.Equals(5))
        {
            Rb3.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction3.Equals(9))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction3.Equals(10))
        {
            Rb3.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction3.Equals(11))
        {
            Rb3.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction3.Equals(12))
        {
            Rb3.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction4.Equals(1))
        {
            Rb4.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction4.Equals(2))
        {
            Rb4.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction4.Equals(3))
        {
            Rb4.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction4.Equals(4))
        {
            Rb4.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction4.Equals(6))
        {
            Rb4.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction4.Equals(7))
        {
            Rb4.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction4.Equals(8))
        {
            Rb4.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction4.Equals(5))
        {
            Rb4.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction4.Equals(9))
        {
            Rb4.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction4.Equals(10))
        {
            Rb4.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction4.Equals(11))
        {
            Rb4.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction4.Equals(12))
        {
            Rb4.AddForce(V * new Vector2(178.9869f, -89.24f));
        }

        if (Direction5.Equals(1))
        {
            Rb5.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction5.Equals(2))
        {
            Rb5.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction5.Equals(3))
        {
            Rb5.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction5.Equals(4))
        {
            Rb5.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction5.Equals(6))
        {
            Rb5.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction5.Equals(7))
        {
            Rb5.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction5.Equals(8))
        {
            Rb5.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction5.Equals(5))
        {
            Rb5.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction5.Equals(9))
        {
            Rb5.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction5.Equals(10))
        {
            Rb5.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction5.Equals(11))
        {
            Rb5.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction5.Equals(12))
        {
            Rb5.AddForce(V * new Vector2(178.9869f, -89.24f));
        }
        B1.GetComponent <Ball> ().Direction = Direction1;
        B2.GetComponent <Ball> ().Direction = Direction2;
        B3.GetComponent <Ball> ().Direction = Direction3;
        B4.GetComponent <Ball> ().Direction = Direction4;
        B5.GetComponent <Ball> ().Direction = Direction5;
        other.GetComponent <Rigidbody2D>().Sleep();
    }
예제 #7
0
    IEnumerator Rexar(int Layer, Collider2D other)
    {
        B1.SetActive(true);
        Tr1.position = Pos1;
        B1.layer     = Layer;
        B1.GetComponent <Ball> ().Direction = Direction1;

        B2.SetActive(true);
        Tr2.position = Pos2;
        B2.layer     = Layer;
        B2.GetComponent <Ball> ().Direction = Direction2;
        //Rb2 = other.GetComponent<Rigidbody2D> ();
        B3.SetActive(true);
        Tr3.position = Pos3;
        B3.layer     = Layer;
        B3.GetComponent <Ball> ().Direction = Direction2;

        B4.SetActive(true);
        Tr4.position = Pos4;
        B4.layer     = Layer;
        B4.GetComponent <Ball> ().Direction = Direction2;

        yield return(new WaitForSeconds(0.1f));

        if (isChange)
        {
            if (Layer.Equals(8))
            {
                //Debug.Log ("AAA");
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(0.0f, 0.0f, 0.0f, 1.0f);
                }
            }
            else if (Layer.Equals(9))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(230 / 255f, 0.0f, 18 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(10))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(0.0f, 153 / 255f, 68 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(11))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(249 / 255f, 230 / 255f, 47 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(12))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(0.0f, 71 / 255f, 157 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(13))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(228 / 255f, 0.0f, 180 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(14))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(0.0f, 160 / 255f, 233 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(15))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
                }
            }
        }

        Rb1.Sleep();
        B1.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb2.Sleep();
        B2.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb3.Sleep();
        B3.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb4.Sleep();
        B4.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Tr1.position = Pos1;
        Tr2.position = Pos2;
        Tr3.position = Pos3;
        Tr4.position = Pos4;


        if (Direction1.Equals(1))
        {
            Rb1.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction1.Equals(2))
        {
            Rb1.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction1.Equals(3))
        {
            Rb1.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction1.Equals(4))
        {
            Rb1.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction1.Equals(8))
        {
            Rb1.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction1.Equals(7))
        {
            Rb1.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction1.Equals(6))
        {
            Rb1.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction1.Equals(5))
        {
            Rb1.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction1.Equals(9))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction1.Equals(10))
        {
            Rb1.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction1.Equals(11))
        {
            Rb1.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction1.Equals(12))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, -89.24f));
        }
        if (Direction1.Equals(13))
        {
            Rb1.AddForce(V * new Vector2(89.24f, 178.9869f));
            Tr1.position = Pos1;
        }
        if (Direction1.Equals(14))
        {
            Rb1.AddForce(V * new Vector2(-89.24f, 178.9869f));
            Tr1.position = Pos1;
        }
        if (Direction1.Equals(15))
        {
            Rb1.AddForce(V * new Vector2(-89.24f, -178.9869f));
            Tr1.position = Pos1;
        }
        if (Direction1.Equals(16))
        {
            Rb1.AddForce(V * new Vector2(89.24f, -178.9869f));
            Tr1.position = Pos1;
        }



        if (Direction2.Equals(1))
        {
            Rb2.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction2.Equals(2))
        {
            Rb2.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction2.Equals(3))
        {
            Rb2.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction2.Equals(4))
        {
            Rb2.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction2.Equals(6))
        {
            Rb2.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction2.Equals(7))
        {
            Rb2.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction2.Equals(8))
        {
            Rb2.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction2.Equals(5))
        {
            Rb2.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction2.Equals(9))
        {
            Rb2.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction2.Equals(10))
        {
            Rb2.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction2.Equals(11))
        {
            Rb2.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction2.Equals(12))
        {
            Rb2.AddForce(V * new Vector2(178.9869f, -89.24f));
        }
        if (Direction2.Equals(13))
        {
            Rb2.AddForce(V * new Vector2(89.24f, 178.9869f));
            Tr2.position = Pos2;
        }
        if (Direction2.Equals(14))
        {
            Rb2.AddForce(V * new Vector2(-89.24f, 178.9869f));
            Tr2.position = Pos2;
        }
        if (Direction2.Equals(15))
        {
            Rb2.AddForce(V * new Vector2(-89.24f, -178.9869f));
            Tr2.position = Pos2;
        }
        if (Direction2.Equals(16))
        {
            Rb2.AddForce(V * new Vector2(89.24f, -178.9869f));
            Tr2.position = Pos2;
        }


        if (Direction3.Equals(1))
        {
            Rb3.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction3.Equals(2))
        {
            Rb3.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction3.Equals(3))
        {
            Rb3.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction3.Equals(4))
        {
            Rb3.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction3.Equals(6))
        {
            Rb3.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction3.Equals(7))
        {
            Rb3.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction3.Equals(8))
        {
            Rb3.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction3.Equals(5))
        {
            Rb3.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction3.Equals(9))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction3.Equals(10))
        {
            Rb3.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction3.Equals(11))
        {
            Rb3.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction3.Equals(12))
        {
            Rb3.AddForce(V * new Vector2(178.9869f, -89.24f));
        }
        if (Direction3.Equals(13))
        {
            Rb3.AddForce(V * new Vector2(89.24f, 178.9869f));
            Tr3.position = Pos3;
        }
        if (Direction3.Equals(14))
        {
            Rb3.AddForce(V * new Vector2(-89.24f, 178.9869f));
            Tr3.position = Pos3;
        }
        if (Direction3.Equals(15))
        {
            Rb3.AddForce(V * new Vector2(-89.24f, -178.9869f));
            Tr3.position = Pos3;
        }
        if (Direction3.Equals(16))
        {
            Rb3.AddForce(V * new Vector2(89.24f, -178.9869f));
            Tr3.position = Pos3;
        }


        if (Direction4.Equals(1))
        {
            Rb4.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction4.Equals(2))
        {
            Rb4.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction4.Equals(3))
        {
            Rb4.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction4.Equals(4))
        {
            Rb4.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction4.Equals(6))
        {
            Rb4.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction4.Equals(7))
        {
            Rb4.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction4.Equals(8))
        {
            Rb4.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction4.Equals(5))
        {
            Rb4.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction4.Equals(9))
        {
            Rb4.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction4.Equals(10))
        {
            Rb4.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction4.Equals(11))
        {
            Rb4.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction4.Equals(12))
        {
            Rb4.AddForce(V * new Vector2(178.9869f, -89.24f));
        }
        if (Direction4.Equals(13))
        {
            Rb4.AddForce(V * new Vector2(89.24f, 178.9869f));
            Tr4.position = Pos4;
        }
        if (Direction4.Equals(14))
        {
            Rb4.AddForce(V * new Vector2(-89.24f, 178.9869f));
            Tr4.position = Pos4;
        }
        if (Direction4.Equals(15))
        {
            Rb4.AddForce(V * new Vector2(-89.24f, -178.9869f));
            Tr4.position = Pos4;
        }
        if (Direction4.Equals(16))
        {
            Rb4.AddForce(V * new Vector2(89.24f, -178.9869f));
            Tr4.position = Pos4;
        }
        B1.GetComponent <Ball> ().Direction = Direction1;
        B2.GetComponent <Ball> ().Direction = Direction2;
        B3.GetComponent <Ball> ().Direction = Direction3;
        B4.GetComponent <Ball> ().Direction = Direction4;
        other.GetComponent <Rigidbody2D>().Sleep();
    }