Exemple #1
0
        private void FindTarget()
        {
            RaycastHit hit;

            if (!Physics.Raycast(camera.position, GetAimVector(), out hit, maxDistance))
            {
                StoreReceiver(null);
                CurrentTarget = hit.collider?.gameObject;
                return;
            }

            CurrentTarget = hit.collider.gameObject;
            Receiver newReceiver = CurrentTarget.GetComponentInParent <Receiver>();

            StoreReceiver(newReceiver);
        }