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))); }
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); }
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); }
//단순히 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); } }
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)); } }
public Element getElement(int x, int y) { return(children[CopyPDTool.CoordToIndex(x, y)].GetComponent <Element>()); }
public Element getElement(Vector2 coord) { return(children[CopyPDTool.CoordToIndex(coord)].GetComponent <Element>()); }