コード例 #1
0
ファイル: Ellipse.cs プロジェクト: THTBa/SLight
    //根据方向来不断执行移动
    void MYButtonEvent(MYDirection _direction)
    {
        //往左移动
        if (_direction == MYDirection.LEFT)
        {
            GameObject temp0 = Sprites[0];//先保存第一个的引用
            if (size <= 0)
            {
                return;
            }
            //右边全部往前一格
            for (int i = 0; i < size - 1; i++)
            {
                Sprites[i] = Sprites[i + 1];
            }
            //右边最后一个直接赋值
            Sprites[size - 1] = Sprites[Sprites.Length - 1];
            //左边全部往后一格
            for (int i = Sprites.Length - 1; i > size; i--)
            {
                Sprites[i] = Sprites[i - 1];
            }
            //左边第一个直接赋值
            Sprites[size] = temp0;

            //移动方块
            Move(MYDirection.LEFT);
            return;
        }
        //往右移动
        else
        {
            GameObject temp0 = Sprites[size];//先保存左边第一个的引用
            if (size <= 0)
            {
                return;
            }
            //左边全部往前一格
            for (int i = size; i < Sprites.Length - 1; i++)
            {
                Sprites[i] = Sprites[i + 1];
            }
            //左边最后一个直接赋值
            Sprites[Sprites.Length - 1] = Sprites[size - 1];
            //右边全部往后一格
            for (int i = size - 1; i > 0; i--)
            {
                Sprites[i] = Sprites[i - 1];
            }
            //左边第一个直接赋值
            Sprites[0] = temp0;
            //左边全部往后一格
            //移动方块
            Move(MYDirection.RIGHT);
            return;
        }
    }
コード例 #2
0
ファイル: Ellipse.cs プロジェクト: puzzzzzzle/FinalWar
        //Test
        List <Vector3> getListend(Vector3 Start_point, Vector3 End_point, MYDirection _direction, int index)
        {
            List <Vector3> newlist     = new List <Vector3>();
            int            endAngle    = getAngle(End_point);
            int            StartAngle  = getAngle(Start_point);
            int            loacleangle = 0;

            if (_direction == MYDirection.LEFT)
            {
                if (index == (size - 1) && endAngle < 360 && endAngle > 270)//如果是左边最后一个
                {
                    loacleangle = -(360 - endAngle + StartAngle) / 3;
                }
                else
                {
                    if (Sprites.Length == 2 && endAngle <= 360 && endAngle >= 270)
                    {
                        loacleangle = (StartAngle - endAngle) / 3;
                    }
                    else
                    {
                        loacleangle = (endAngle - StartAngle) / 3;
                    }
                }
            }
            else
            {
                if (index == (Sprites.Length - 1) && StartAngle < 360 && StartAngle > 270)//如果是右边最后一个
                {
                    loacleangle = (360 - StartAngle + endAngle) / 3;
                }
                else
                {
                    if (Sprites.Length == 2 && StartAngle <= 360 && StartAngle >= 270)
                    {
                        loacleangle = (StartAngle - endAngle) / 3;
                    }
                    else
                    {
                        loacleangle = (endAngle - StartAngle) / 3;
                    }
                }
            }
            float   angle   = (float)(StartAngle + loacleangle);
            Vector3 centPos = centerPos;
            Vector3 tem     = GetPoint(angle, centPos);

            newlist.Add(tem);
            angle += loacleangle;
            tem    = GetPoint(angle, centPos);
            newlist.Add(tem);
            newlist.Add(End_point);
            return(newlist);
        }
コード例 #3
0
ファイル: Ellipse.cs プロジェクト: THTBa/SLight
    //移动的函数
    void Move(MYDirection _direction)
    {
        int size = Sprites.Length;

        for (int i = 0; i < size; i++)
        {
            //使用itween接口实现移动效果
            Hashtable table = gethashtable(location[i]);
            // iTween.MoveTo(Sprites[i],table);
            List <Vector3> newlist = getListend(Sprites[i].transform.position, location[i], _direction, i);
            table.Add("Ellipse", newlist);
            ManagerEffective.MoveTo(Sprites[i], table, newlist);
        }
        StartCoroutine(judgeifneedrestdepth());
    }
コード例 #4
0
ファイル: Ellipse.cs プロジェクト: THTBa/SLight
    //Test
    List <Vector3> getListend(Vector3 Start_point, Vector3 End_point, MYDirection _direction, int index)
    {
        List <Vector3> newlist     = new List <Vector3>();
        int            endAngle    = getAngle(End_point);
        int            StartAngle  = getAngle(Start_point);
        int            loacleangle = 0;

        if (_direction == MYDirection.LEFT)
        {
            if (index == (size - 1) && endAngle < 360 && endAngle > 270)//如果是左边最后一个
            {
                loacleangle = -(360 - endAngle + StartAngle) / 3;
            }
            else
            {
                if (Sprites.Length == 2 && endAngle <= 360 && endAngle >= 270)
                {
                    loacleangle = (StartAngle - endAngle) / 3;
                }
                else
                {
                    loacleangle = (endAngle - StartAngle) / 3;
                }
            }
        }
        else
        {
            if (index == (Sprites.Length - 1) && StartAngle < 360 && StartAngle > 270)//如果是右边最后一个
            {
                loacleangle = (360 - StartAngle + endAngle) / 3;
            }
            else
            {
                if (Sprites.Length == 2 && StartAngle <= 360 && StartAngle >= 270)
                {
                    loacleangle = (StartAngle - endAngle) / 3;
                }
                else
                {
                    loacleangle = (endAngle - StartAngle) / 3;
                }
            }
        }
        Vector3 centerPos = centerPoint.position;

        Debug.Log("**********************************this Time is  new one and the name is" + Sprites[index].name);
        Debug.Log("start Position and angle is :" + Start_point + "and" + StartAngle);
        Debug.Log("end Position and angle is :" + End_point + "and" + endAngle);
        Debug.Log("local ang;e and angle is :" + loacleangle);
        float   angle   = (float)(StartAngle + loacleangle);
        Vector3 centPos = centerPos;
        Vector3 tem     = GetPoint(angle, centPos);

        Debug.Log("tem Position and angle is :" + tem + "and" + angle);
        newlist.Add(tem);
        angle += loacleangle;
        tem    = GetPoint(angle, centPos);
        Debug.Log("tem Position and angle is :" + tem + "and" + angle);
        newlist.Add(tem);
        newlist.Add(End_point);
        return(newlist);
    }
コード例 #5
0
ファイル: Ellipse.cs プロジェクト: puzzzzzzle/FinalWar
 //根据方向来不断执行移动
 void MYButtonEvent(MYDirection _direction)
 {
     for (int i = 0; i < Sprites.Length; i++)
     {
         Sprites[i].GetComponent <Button>().enabled = false;
     }
     //往左移动
     if (_direction == MYDirection.LEFT)
     {
         GameObject temp0 = Sprites[0]; //先保存第一个的引用
         string     mode  = modes[0];   //先保留第一个modes值
         if (size <= 0)
         {
             return;
         }
         //右边全部往前一格
         for (int i = 0; i < size - 1; i++)
         {
             Sprites[i] = Sprites[i + 1];
             modes[i]   = modes[i + 1];
         }
         //右边最后一个直接赋值
         Sprites[size - 1] = Sprites[Sprites.Length - 1];
         modes[size - 1]   = modes[modes.Length - 1];
         //左边全部往后一格
         for (int i = Sprites.Length - 1; i > size; i--)
         {
             Sprites[i] = Sprites[i - 1];
             modes[i]   = modes[i - 1];
         }
         //左边第一个直接赋值
         Sprites[size] = temp0;
         modes[size]   = mode;
         //给Text赋值
         curMode.text = modes[0];
         //移动方块
         Move(MYDirection.LEFT);
         return;
     }
     //往右移动
     else
     {
         GameObject temp0 = Sprites[size]; //先保存左边第一个的引用
         string     mode  = modes[size];   //先保存左边第一个模式
         if (size <= 0)
         {
             return;
         }
         //左边全部往前一格
         for (int i = size; i < Sprites.Length - 1; i++)
         {
             Sprites[i] = Sprites[i + 1];
             modes[i]   = modes[i + 1];
         }
         //左边最后一个直接赋值
         Sprites[Sprites.Length - 1] = Sprites[size - 1];
         modes[modes.Length - 1]     = modes[size - 1];
         //右边全部往后一格
         for (int i = size - 1; i > 0; i--)
         {
             Sprites[i] = Sprites[i - 1];
             modes[i]   = modes[i - 1];
         }
         //左边第一个直接赋值
         Sprites[0] = temp0;
         modes[0]   = mode;
         //给Text赋值
         curMode.text = modes[0];
         //左边全部往后一格
         //移动方块
         Move(MYDirection.RIGHT);
         return;
     }
 }