Esempio n. 1
0
File: RayTest.cs Progetto: wHo2/TMC
 public void DeleteLine(Point p1,Point p2)
 {
     DeleteLine(p1.GetUni(), p2.GetUni());
 }
Esempio n. 2
0
File: RayTest.cs Progetto: wHo2/TMC
    public void Link(GameObject crystal)
    {
        if (crystal != null)//水晶连线   && linkStop == false
        {
            if (!draw)//如果还没开始画线
            {
                //if (EnergyManager.Instance.accessibleEnergy > 0)
                {
                    #region
                    float x = 0, z = 0; int kx = -1, ky = -1;
                    linePoints = new Vector3[2];
                    linePoints[0] = crystal.transform.position;
                    z = EnergyManager.Instance.HeroMagicCircle.getz(linePoints[0].z);
                    if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[2])
                        x = EnergyManager.Instance.HeroMagicCircle.getx1(linePoints[0].x);
                    else if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[0] || z == EnergyManager.Instance.HeroMagicCircle.rowKey[4])
                        x = EnergyManager.Instance.HeroMagicCircle.getx2(linePoints[0].x);
                    else
                        x = EnergyManager.Instance.HeroMagicCircle.getx3(linePoints[0].x);
                    kx = EnergyManager.Instance.HeroMagicCircle.getKx(x);
                    ky = EnergyManager.Instance.HeroMagicCircle.getKy(z);
                    if (kx != -1)
                    {
                        l1 = new Point( kx , ky);
                        draw = true;
                        //EnergyManager.Instance.MinusEnergy(1);
                    }
                    screenSpace = Camera.main.WorldToScreenPoint(crystal.transform.position);
                    linePoints[1] = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z));
                    temp1 = new VectorLine("3DLine", linePoints, Color.green, lineMaterial, 8.0f);
                    temp2 = new VectorLine("3DLine", linePoints, Color.green, lineMaterial2, 15.0f);
                    temp1.Draw3DAuto();
                    temp2.Draw3DAuto();
                    #endregion
                }
                //else
                //{
                //    //linkStop = true;
                //}
            }
            else
            {
                #region
                float x = 0, z = 0; int kx = -1, ky = -1;
                linePoints[1] = crystal.transform.position;
                z = EnergyManager.Instance.HeroMagicCircle.getz(linePoints[1].z);
                if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[2])
                    x = EnergyManager.Instance.HeroMagicCircle.getx1(linePoints[1].x);
                else if (z == EnergyManager.Instance.HeroMagicCircle.rowKey[0] || z == EnergyManager.Instance.HeroMagicCircle.rowKey[4])
                    x = EnergyManager.Instance.HeroMagicCircle.getx2(linePoints[1].x);
                else
                    x = EnergyManager.Instance.HeroMagicCircle.getx3(linePoints[1].x);
                kx = EnergyManager.Instance.HeroMagicCircle.getKx(x);
                ky = EnergyManager.Instance.HeroMagicCircle.getKy(z);
                l2 = new Point(kx , ky);
                if (l2 == l1)//连自己=>取消连线
                {
                    VectorLine.Destroy(ref temp1);
                    VectorLine.Destroy(ref temp2);
                    //EnergyManager.Instance.MinusEnergy(-1);
                }
                else if (EnergyManager.Instance.HeroMagicCircle.IsOperable(new Line(l1,l2)))
                {
                    if (kx != -1 && !EnergyManager.Instance.HeroMagicCircle.GetLine(l1, l2) && EnergyManager.Instance.HeroMagicCircle.GetLineSwitch(l1.GetX(), l1.GetY(), l2.GetX(), l2.GetY()))//画线
                    {
                        //AddLine(l1, l2);
                        if (EnergyManager.Instance.accessibleEnergy>0)
                        {
                            temp1.Draw3D();
                            temp2.Draw3D();
                            line[l1.GetUni(), l2.GetUni()] = temp1; line2[l1.GetUni(), l2.GetUni()] = temp2;
                            EnergyManager.Instance.HeroMagicCircle.LineTrue(l1.GetUni(), l2.GetUni());
                            EnergyManager.Instance.MinusEnergy(1);
                        }
                        else
                        {
                            VectorLine.Destroy(ref temp1);
                            VectorLine.Destroy(ref temp2);
                            GuideText.Instance.ReturnText("LinkNeedEnergy");
                        }
                    }
                    else if (EnergyManager.Instance.HeroMagicCircle.GetLine(l1, l2))//删线
                    {

                        // Debug.Log("delete");
                        DeleteLine(l1, l2);
                        VectorLine.Destroy(ref temp1);
                        VectorLine.Destroy(ref temp2);
                        GuideText.Instance.GuideLevel(2, 33, "RedundentLink");
                        GuideText.Instance.GuideLevel(3, 33, "RedundentLink");
                        //EnergyManager.Instance.MinusEnergy(-1);
                        //linkStop = true;
                    }
                }
                else
                {
                    GuideText.Instance.ReturnText("NoJumpLink");
                    return;
                }
                draw = false;
                #endregion
            }
        }
    }
Esempio n. 3
0
File: Card.cs Progetto: wHo2/TMC
    void patternCreate(List<int[]> Pattern)
    {
        Point point1, point2;
        for (int i = 0; i < Pattern.Count; i++)
        {
            point1 = new Point(Pattern[i][0], Pattern[i][1]);
            point2 = new Point(Pattern[i][2], Pattern[i][3]);
            if ( isHeros &&!EnergyManager.Instance.HeroMagicCircle.GetLine(point1, point2))
            {
                //Debug.Log("pattenCreate"+Pattern[i][0].ToString() + "+" + Pattern[i][1].ToString() + "+" + Pattern[i][2].ToString() + "+" + Pattern[i][3].ToString());
                RayTest.Instance.AddLine(point1.GetUni(), point2.GetUni());

            }
            if(!isHeros && !EnergyManager.Instance.EnemyMagicCircle.GetLine(point1,point2))
            {
                EnergyManager.Instance.EnemyMagicCircle.LineTrue(point1.GetUni(), point2.GetUni());
            }
        }
    }
Esempio n. 4
0
 /// <summary>
 /// 取得Line(x,y)的值
 /// </summary>
 public bool GetLine(Point p1,Point p2)
 {
     return line[p1.GetUni(), p2.GetUni()];
 }
Esempio n. 5
0
File: Card.cs Progetto: wHo2/TMC
 void patternDel(List<int[]> Pattern)
 {
     Point point1, point2;
     for (int i = 0; i < Pattern.Count; i++)
     {
         point1 = new Point(Pattern[i][0], Pattern[i][1]);
         point2 = new Point(Pattern[i][2], Pattern[i][3]);
         //Debug.Log("pattenDel" + Pattern[i][0].ToString() + "+" + Pattern[i][1].ToString() + "+" + Pattern[i][2].ToString() + "+" + Pattern[i][3].ToString());
         if (isHeros)
             RayTest.Instance.DeleteLine(point1, point2);
         else
             EnergyManager.Instance.EnemyMagicCircle.DeleteLine(point1.GetUni(), point2.GetUni());
     }
 }