Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Tile tile = TileHelper.TileUnderPos(Camera.main.ScreenToWorldPoint(Input.mousePosition));

            if (pl.IsPlaceable(tile))
            {
                pl.PlaceSelectedOnTile(tile);
            }
        }

        foreach (Touch t in Input.touches)
        {
            if (t.phase == TouchPhase.Began)
            {
                Tile tile = TileHelper.TileUnderPos(Camera.main.ScreenToWorldPoint(t.position));

                if (pl.IsPlaceable(tile))
                {
                    pl.PlaceSelectedOnTile(tile);
                }
            }
        }
    }