Exemple #1
0
 private void OnMouseDown()
 {
     if (sendObject)
     {
         sendObject.SetDestination(targetPosition);
     }
 }
    private void Update()
    {
        Vector3    mpos = Input.mousePosition;
        Ray        ray  = Camera.main.ScreenPointToRay(mpos);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (!hit.collider.CompareTag("Player"))
            {
                Vector3 target = hit.point;
                if (Vector3.Distance(target, setDestination) > resetDestinationDistance)
                {
                    setDestination = target;
                    navCon.SetDestination(target);
                }
            }
        }
    }