2026-05-20 무기습득
This commit is contained in:
24
Assets/HighlightPlus/Demo/Scripts/HitFxDemo.cs
Normal file
24
Assets/HighlightPlus/Demo/Scripts/HitFxDemo.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user