コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (placeableInHand as Object != null)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, Mathf.Infinity))
            {
                Transform root = hit.transform.root;
                if (!placeableInHand.ToTransform(root))
                {
                    placeableInHand.ToPosition(PlayerInput.mouseWorldPosition, Quaternion.identity);
                }
            }

            if (Input.GetButtonDown("Fire1"))
            {
                Place();
            }
        }

        defensiveTurretCapacityText.text = "Turrets: " + DefensiveTurret.allDefensiveTurrets.Count + " / " + DefensiveTurret.defensiveTurretCapacity;
    }