Exemplo n.º 1
0
    public static GameObject GetFromPlane(int row, int col, PlanePosition.PlaneType type)
    {
        Vector2 start = CoordsToVec2(row, col);

        Collider2D[] hits = Physics2D.OverlapBoxAll(start, Vector2.one * 0.1f, 0.0f);
        foreach (Collider2D hit in hits)
        {
            GameObject    obj = hit.gameObject;
            PlanePosition p   = obj.GetComponent <PlanePosition>();
            if (p && p.Matches(row, col, type))
            {
                return(obj);
            }
        }
        return(null);
    }