예제 #1
0
    public int compareCoord(Transform a, Transform b)
    {         //a가 작으면 -1 같으면 버그 a가 크면 1을 리턴하면 될듯ㅇㅇ;
        Vector2 aCoord = a.GetComponent <Element>().coord;
        Vector2 bCoord = b.GetComponent <Element>().coord;

        return(CopyPDTool.CoordToIndex(aCoord).CompareTo(CopyPDTool.CoordToIndex(bCoord)));
    }
예제 #2
0
    public Element.elementType getElementType(Vector2 coord)
    {
        if (coord.x < 0 || coord.y < 0 || coord.x >= column || coord.y >= row)
        {
            return(Element.elementType.nothing);
        }

        return(children[CopyPDTool.CoordToIndex(coord)].GetComponent <Element>().type);
    }
예제 #3
0
    public Element.elementType getElementType(int x, int y)
    {
        if (x < 0 || y < 0 || x > column || y > row)
        {
            return(Element.elementType.nothing);
        }

        return(children[CopyPDTool.CoordToIndex(x, y)].GetComponent <Element>().type);
    }
예제 #4
0
 //단순히 UITable에서 Start를 쓰고 있기떄문에 Awake를 씀...
 void Awake()
 {
     for (int n = 0; n < transform.childCount; n++)
     {
         Transform child = transform.GetChild(n);
         child.transform.name = "Element" + n;
         child.GetComponent <Element>().coord = CopyPDTool.IndexToCoord(n);
     }
 }
예제 #5
0
    void OnDragOver(GameObject col)
    {
        if (col != gameObject && !key)
        {
            key = true;
            CopyPDTool.SwapCoord(col.GetComponent <Element>(), this);
            AudioSource.PlayClipAtPoint(GameCore.instance.swapSound, transform.position);
            int first  = CopyPDTool.CoordToIndex(coord);
            int second = CopyPDTool.CoordToIndex(col.GetComponent <Element>().coord);
            board.children.Swap(first, second);

            StartCoroutine(CircleMoveDrop(coordPosition, 0.08f));
        }
    }
예제 #6
0
 public Element getElement(int x, int y)
 {
     return(children[CopyPDTool.CoordToIndex(x, y)].GetComponent <Element>());
 }
예제 #7
0
 public Element getElement(Vector2 coord)
 {
     return(children[CopyPDTool.CoordToIndex(coord)].GetComponent <Element>());
 }