Esempio n. 1
0
    public void CheckAllBombs()
    {
        GridCreater gridCreater = GameObject.Find("Main Camera").GetComponent <GridCreater>();


        for (int i = 1; i < gridCreater.GetHexAmound() + 1; i++)
        {
            Hex CurrentHex = GameObject.Find(i.ToString()).GetComponent <Hex>();
            if (CurrentHex.GetHexType() == Hex.HexType.Bomb)
            {
                CurrentHex.SetBombTick();
            }
        }
    }
Esempio n. 2
0
    public void Drop2()
    {
        GridCreater gridCreater = GameObject.Find("Main Camera").GetComponent <GridCreater>();
        int         HexNo       = int.Parse(this.name);

        //Debug.Log(HexNo);
        //Debug.Log(HexNo + gridCreater.Vertical);
        //Debug.Log(gridCreater.GetHexAmound());
        if (HexNo + (gridCreater.Vertical * 2) <= gridCreater.GetHexAmound())
        {
            Hex UpperHex = GameObject.Find((HexNo + (gridCreater.Vertical * 2)).ToString()).GetComponent <Hex>();

            if (UpperHex.GetHexInfo().HexColor != Hex.Color.Empty)
            {
                if (UpperHex.MyHexType == HexType.Bomb)
                {
                    UpperHex.SetHexType(HexType.Normal);
                    MyHexType             = HexType.Bomb;
                    BombFuseTime          = UpperHex.BombFuseTime;
                    UpperHex.BombFuseTime = 10;
                }
                SetHexInfo(UpperHex.GetHexInfo());
                UpperHex.Drop2();
            }
            else
            {
                UpperHex.Drop2();
                Drop2();
            }
        }
        else
        {
            if (ScoreScript.BombScoreValue > 1000)
            {
                RandomBombGenerate();
                ScoreScript.BombScoreValue -= 1000;
            }
            else
            {
                RandomHexGenerate();
            }

            GridCreater.OngoingDropCount -= 1;
            if (GridCreater.OngoingDropCount == 0)
            {
                CheckAllRotators();
            }
        }
    }
Esempio n. 3
0
    public void CheckAllRotators()
    {
        GridCreater gridCreater = GameObject.Find("Main Camera").GetComponent <GridCreater>();

        for (int i = gridCreater.GetRotatorAmound() + 1; i > 0; i--)
        {
            //Upper  Rotator's PairCheck
            GameObject Rotator = GameObject.Find(i.ToString() + "Rot");
            if (Rotator != null)
            {
                //Debug.Log(i);
                Rotator.GetComponent <Rotator>().PairCheck();
            }
        }
    }
Esempio n. 4
0
    public void CheckCloseRotators()
    {
        int RotatorNo = int.Parse(this.name.Replace("Rot", ""));
        //Debug.Log(RotatorNo);
        GridCreater gridCreater = GameObject.Find("Main Camera").GetComponent <GridCreater>();


        //Upper  Rotator's PairCheck
        GameObject UpperRotator = GameObject.Find((RotatorNo + gridCreater.Vertical - 1).ToString() + "Rot");

        if (UpperRotator != null)
        {
            UpperRotator.GetComponent <Rotator>().PairCheck();
        }
        //Downer Rotator's PairCheck
        GameObject DownRotator = GameObject.Find((RotatorNo - (gridCreater.Vertical - 1)).ToString() + "Rot");

        if (DownRotator != null)
        {
            DownRotator.GetComponent <Rotator>().PairCheck();
        }
        //Right  Rotator's PairCheck
        GameObject RightRotator = GameObject.Find((RotatorNo + 1).ToString() + "Rot");

        if (RightRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 0)
        {
            RightRotator.GetComponent <Rotator>().PairCheck();
        }
        //Left   Rotator's PairCheck
        GameObject LeftRotator = GameObject.Find((RotatorNo - 1).ToString() + "Rot");

        if (LeftRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 1)
        {
            LeftRotator.GetComponent <Rotator>().PairCheck();
        }



        //UpperRight   Rotator's PairCheck
        GameObject UpperRightRotator = GameObject.Find(((RotatorNo + (gridCreater.Vertical - 1)) + 1).ToString() + "Rot");

        Debug.Log(((RotatorNo + (gridCreater.Vertical - 1)) + 1));
        if (UpperRightRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 0)
        {
        }
        UpperRightRotator.GetComponent <Rotator>().PairCheck();

        //UpperLeft   Rotator's PairCheck
        GameObject UpperLeftRotator = GameObject.Find(((RotatorNo + (gridCreater.Vertical - 1)) - 1).ToString() + "Rot");

        if (UpperLeftRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 1)
        {
            UpperLeftRotator.GetComponent <Rotator>().PairCheck();
        }


        //DownerRight Rotator's PairCheck
        GameObject DownRightRotator = GameObject.Find(((RotatorNo - (gridCreater.Vertical - 1)) + 1).ToString() + "Rot");

        if (DownRightRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 0)
        {
        }
        DownRightRotator.GetComponent <Rotator>().PairCheck();

        //LeftRight Rotator's PairCheck
        GameObject DownLeftRotator = GameObject.Find(((RotatorNo - (gridCreater.Vertical - 1)) - 1).ToString() + "Rot");

        if (DownRightRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 1)
        {
            DownRightRotator.GetComponent <Rotator>().PairCheck();
        }



        //UpperUpper   Rotator's PairCheck
        GameObject UpperUpperRotator = GameObject.Find(((RotatorNo + ((gridCreater.Vertical - 1) * 2))).ToString() + "Rot");

        if (UpperUpperRotator != null)
        {
            UpperUpperRotator.GetComponent <Rotator>().PairCheck();
        }

        //DownDown   Rotator's PairCheck
        GameObject DownDownRotator = GameObject.Find(((RotatorNo - ((gridCreater.Vertical - 1) * 2))).ToString() + "Rot");

        if (DownDownRotator != null)
        {
            DownDownRotator.GetComponent <Rotator>().PairCheck();
        }

        //UpperUpperRight   Rotator's PairCheck
        GameObject UpperUpperRightRotator = GameObject.Find((((RotatorNo + ((gridCreater.Vertical - 1) * 2)) + 1)).ToString() + "Rot");

        if (UpperUpperRightRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 0)
        {
            UpperUpperRightRotator.GetComponent <Rotator>().PairCheck();
        }

        //UpperUpperLeft   Rotator's PairCheck
        GameObject UpperUpperLeftRotator = GameObject.Find((((RotatorNo + ((gridCreater.Vertical - 1) * 2)) - 1)).ToString() + "Rot");

        if (UpperUpperLeftRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 1)
        {
            UpperUpperLeftRotator.GetComponent <Rotator>().PairCheck();
        }

        //DownDownRight   Rotator's PairCheck
        GameObject DownDownRightRotator = GameObject.Find(((RotatorNo - ((gridCreater.Vertical - 1) * 2)) + 1).ToString() + "Rot");

        if (DownDownRightRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 0)
        {
            DownDownRightRotator.GetComponent <Rotator>().PairCheck();
        }

        //DownDownLeft   Rotator's PairCheck
        GameObject DownDownLeftRotator = GameObject.Find(((RotatorNo - ((gridCreater.Vertical - 1) * 2)) - 1).ToString() + "Rot");

        if (DownDownLeftRotator != null && (RotatorNo % (gridCreater.Vertical - 1)) != 1)
        {
            DownDownLeftRotator.GetComponent <Rotator>().PairCheck();
        }
    }
Esempio n. 5
0
    public void PairCheck()
    {
        if (Hex1.GetHexInfo().HexColor == Hex2.GetHexInfo().HexColor &&
            Hex2.GetHexInfo().HexColor == Hex3.GetHexInfo().HexColor &&
            Hex3.GetHexInfo().HexColor == Hex1.GetHexInfo().HexColor)
        {
            //Debug.Log(+15);
            ScoreScript.scoreValue     += 15;
            ScoreScript.BombScoreValue += 15;

            Hex.HexInfo buffer;
            buffer.HexColor   = Hex.Color.Empty;
            buffer.SpriteName = "HexEmpty";
            Hex1.SetHexInfo(buffer);
            Hex2.SetHexInfo(buffer);
            Hex3.SetHexInfo(buffer);

            //wait a second
            GridCreater gridCreater  = GameObject.Find("Main Camera").GetComponent <GridCreater>();
            int         RotatorNo    = int.Parse(this.name.Replace("Rot", ""));
            int         ColumnNumber = (((RotatorNo - 1) / (gridCreater.Vertical - 1)));
            int         RowNumber    = RotatorNo - ((ColumnNumber) * (gridCreater.Vertical - 1));
            if (RowNumber == 0)
            {
                RowNumber = gridCreater.Vertical - 1;
            }

            GridCreater.OngoingDropCount += 3;
            ColumnNumber++;
            //Debug.Log(ColumnNumber);
            //Debug.Log(RowNumber);

            if (ColumnNumber % 2 == 0)
            {
                if (RowNumber % 2 == 0)
                {
                    //Debug.Log("SOL");

                    Hex2.Drop1();
                    Hex3.Drop2();
                    Hex1.Drop2();
                }
                else
                {
                    //Debug.Log("SAG");
                    Hex2.Drop1();
                    Hex1.Drop2();
                    Hex3.Drop2();
                }
            }
            else
            {
                if (RowNumber % 2 == 0)
                {
                    //Debug.Log("SAG");
                    Hex2.Drop1();
                    Hex1.Drop2();
                    Hex3.Drop2();
                }
                else
                {
                    //Debug.Log("SOL");
                    Hex2.Drop1();
                    Hex3.Drop2();
                    Hex1.Drop2();
                }
            }
        }
    }