コード例 #1
0
    public void SelectOtherDragPoint(int offset)
    {
        string nextDragpointName = null;

        for (int i = 0; i < dragPointNames.Length; i++)
        {
            if (dragPointNames [i].Equals(transform.name))
            {
                int nextIndex = (i + offset);
                while (nextIndex < 0)
                {
                    nextIndex += dragPointNames.Length;
                }
                nextIndex        %= dragPointNames.Length;
                nextDragpointName = dragPointNames [nextIndex];
            }
        }

        if (nextDragpointName != null)
        {
            GameObject  nextDragpoint = GameObject.Find(nextDragpointName);
            DragAndDrop dragAndDrop   = nextDragpoint.GetComponent <DragAndDrop> ();
            if (dragAndDrop != null)
            {
                this.Deselect();
                dragAndDrop.Select();
            }
        }
    }