コード例 #1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        Debug.Log("Click");
        int x = Mathf.FloorToInt(0.5f + eventData.pointerCurrentRaycast.worldPosition.x);
        int y = Mathf.FloorToInt(0.5f + eventData.pointerCurrentRaycast.worldPosition.y);

        MapTile2 tile = mapCreator.GetTile(x, y);

        mapCreator.ResetMap();
        tile.target = true;
    }
コード例 #2
0
    public void GenerateMap()
    {
        for (int j = 0; j < mapSizeY; j++)
        {
            for (int i = 0; i < mapSizeX; i++)
            {
                Transform tile = Instantiate(tilePrefab);
                tile.position = new Vector3(i, j, 0);
                tile.parent   = transform;

                MapTile2 tempTile = tile.GetComponent <MapTile2>();
                tempTile.posx = i;
                tempTile.posy = j;

                tiles.Add(tempTile);
            }
        }
    }