Ejemplo n.º 1
0
 void turn3()
 {
     SecoundHex.position = Vector3.Lerp(SecoundHex.position, pos2, Time.deltaTime * 15);
     SecoundHex.parent   = column2index;
     SecoundHex.SetSiblingIndex(index2);
     ThirdHex.position = Vector3.Lerp(ThirdHex.position, pos3, Time.deltaTime * 15);
     ThirdHex.parent   = column3index;
     ThirdHex.SetSiblingIndex(index3);
     FirstHex.position = Vector3.Lerp(FirstHex.position, pos1, Time.deltaTime * 15);
     FirstHex.parent   = column1index;
     FirstHex.SetSiblingIndex(index1);
     Invoke("SetClickability", 0.2f);
 }
Ejemplo n.º 2
0
 void turn2()
 {
     FirstTurn         = false;
     ThirdHex.position = Vector3.Lerp(ThirdHex.position, pos2, Time.deltaTime * 15);
     ThirdHex.parent   = column2index;
     ThirdHex.SetSiblingIndex(index2);
     FirstHex.position = Vector3.Lerp(FirstHex.position, pos3, Time.deltaTime * 15);
     FirstHex.parent   = column3index;
     FirstHex.SetSiblingIndex(index3);
     SecoundHex.position = Vector3.Lerp(SecoundHex.position, pos1, Time.deltaTime * 15);
     SecoundHex.parent   = column1index;
     SecoundHex.SetSiblingIndex(index1);
     Invoke("turn3", 0.2f);
 }
Ejemplo n.º 3
0
 void ShowSelected()
 {
     if (ThirdHex && FirstHex && SecoundHex != null)
     {
         Hex1Anim = FirstHex.GetComponent <Animator>();
         Hex2Anim = SecoundHex.GetComponent <Animator>();
         Hex3Anim = ThirdHex.GetComponent <Animator>();
         if (PlayAnim)
         {
             Hex1Anim.SetBool("select", true);
             Hex2Anim.SetBool("select", true);
             Hex3Anim.SetBool("select", true);
         }
         else if (!PlayAnim)
         {
             Hex1Anim.SetBool("select", false);
             Hex2Anim.SetBool("select", false);
             Hex3Anim.SetBool("select", false);
         }
     }
 }
Ejemplo n.º 4
0
    void GetNeighbour()
    {
        int ColumnIndex = FirstHex.parent.GetSiblingIndex();
        int RowIndex    = FirstHex.GetSiblingIndex();


        if (RightColumn)
        {
            if (ColumnIndex != Xrow - 1)
            {
                Transform NeighbourRight = this.transform.GetChild(ColumnIndex + 1);
                if (RowIndex % 2 != 0)
                {
                    OddOrEvenCheck = NeighbourRight;
                }
                else if (RowIndex % 2 == 0)
                {
                    OddOrEvenCheck = FirstHex.parent;
                }
                if (DownRow && RowIndex != 0)
                {
                    SecoundHex = OddOrEvenCheck.GetChild(RowIndex - 1);
                    ThirdHex   = NeighbourRight.GetChild(RowIndex);
                }
                else if (DownRow && RowIndex == 0)
                {
                    SecoundHex = OddOrEvenCheck.GetChild(RowIndex + 1);
                    ThirdHex   = NeighbourRight.GetChild(RowIndex);
                }
                else if (!DownRow && RowIndex != Yrow - 1)
                {
                    SecoundHex = OddOrEvenCheck.GetChild(RowIndex + 1);
                    ThirdHex   = NeighbourRight.GetChild(RowIndex);
                }
                else if (!DownRow && RowIndex == Yrow - 1)
                {
                    SecoundHex = OddOrEvenCheck.GetChild(RowIndex - 1);
                    ThirdHex   = NeighbourRight.GetChild(RowIndex);
                }
                PlayAnim = true;
                ShowSelected();
                pos1         = FirstHex.transform.position;
                pos2         = SecoundHex.transform.position;
                pos3         = ThirdHex.transform.position;
                index1       = FirstHex.GetSiblingIndex();
                index2       = SecoundHex.GetSiblingIndex();
                index3       = ThirdHex.GetSiblingIndex();
                column1index = FirstHex.parent;
                column2index = SecoundHex.parent;
                column3index = ThirdHex.parent;
            }
            else if (ColumnIndex == Xrow - 1)
            {
                PlayAnim    = true;
                RightColumn = false;
                GetNeighbour();
            }
        }
        else if (!RightColumn)
        {
            if (ColumnIndex != 0)
            {
                Transform NeighbourLeft = this.transform.GetChild(ColumnIndex - 1);
                if (RowIndex % 2 != 0)
                {
                    OddOrEvenCheck = FirstHex.parent;
                }
                else if (RowIndex % 2 == 0)
                {
                    OddOrEvenCheck = NeighbourLeft;
                }

                if (DownRow && RowIndex != 0)
                {
                    SecoundHex = OddOrEvenCheck.GetChild(RowIndex - 1);
                    ThirdHex   = NeighbourLeft.GetChild(RowIndex);
                }
                else if (DownRow && RowIndex == 0)
                {
                    SecoundHex = OddOrEvenCheck.GetChild(RowIndex + 1);
                    ThirdHex   = NeighbourLeft.GetChild(RowIndex);
                }
                else if (!DownRow && RowIndex != Yrow - 1)
                {
                    SecoundHex = OddOrEvenCheck.GetChild(RowIndex + 1);
                    ThirdHex   = NeighbourLeft.GetChild(RowIndex);
                }
                else if (!DownRow && RowIndex == Yrow - 1)
                {
                    SecoundHex = OddOrEvenCheck.GetChild(RowIndex - 1);
                    ThirdHex   = NeighbourLeft.GetChild(RowIndex);
                }
                PlayAnim = true;
                ShowSelected();
                pos1         = FirstHex.transform.position;
                pos2         = SecoundHex.transform.position;
                pos3         = ThirdHex.transform.position;
                index1       = FirstHex.GetSiblingIndex();
                index2       = SecoundHex.GetSiblingIndex();
                index3       = ThirdHex.GetSiblingIndex();
                column1index = FirstHex.parent;
                column2index = SecoundHex.parent;
                column3index = ThirdHex.parent;
            }
            else if (ColumnIndex == 0)
            {
                PlayAnim    = true;
                RightColumn = true;
                GetNeighbour();
            }
        }
    }