コード例 #1
0
    private void Update()
    {
        closest = levelGrid.FindClosestTile(transform.position);

        Vector3 diff = closest.transform.position - transform.position;

        diff.y = 0.0f;

        // If the closest tile is within range
        if (diff.magnitude < maxRange && !closest.IsOccupied())
        {
            targetIndicator.SetActive(true);
            targetIndicator.transform.position = closest.transform.position;
            targetIndicator.transform.rotation = closest.transform.rotation;
        }
        else
        {
            targetIndicator.SetActive(false);
            closest = null;
        }
    }