You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
648 B
24 lines
648 B
using UnityEngine; |
|
|
|
namespace HighlightPlus.Demos { |
|
|
|
public class HitFxDemo : MonoBehaviour { |
|
|
|
public AudioClip hitSound; |
|
|
|
void Update() { |
|
|
|
if (!InputProxy.GetMouseButtonDown(0)) return; |
|
|
|
Ray ray = Camera.main.ScreenPointToRay(InputProxy.mousePosition); |
|
if (Physics.Raycast(ray, out RaycastHit hitInfo)) { |
|
HighlightEffect effect = hitInfo.collider.GetComponent<HighlightEffect>(); |
|
if (effect == null) return; |
|
AudioSource.PlayClipAtPoint(hitSound, hitInfo.point); |
|
effect.HitFX(hitInfo.point); |
|
} |
|
|
|
} |
|
} |
|
|
|
} |