예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (currentObject != null && overheadCamera != null)
        {
            if (!hasPlaced)
            {
                Vector3 mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, overheadCamera.transform.position.y);
                Vector3 p        = overheadCamera.ScreenToWorldPoint(mousePos);
                currentObject.position = new Vector3(p.x, 0, p.z);
            }


            //TODO: Replace with key/button bindable option.
            if (Input.GetMouseButtonDown(0))
            {
                if (IsLegalPosition())
                {
                    hasPlaced = true;
                    placeableObject.SetMaterial(PlaceableObject.PlaceableItemMaterial.ORIGINAL);
                    placeableObject.Placed = true;
                }
            }
        }
    }