blob: 0d6eef13fd5199dca81f08dbc520e450b53893b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
using UnityEngine;
namespace ch.sycoforge.Decal.Demo;
public class BasicBulletHoles : MonoBehaviour
{
public EasyDecal DecalPrefab;
private bool t;
public void Start()
{
if (DecalPrefab == null)
{
Debug.LogError("The DynamicDemo script has no decal prefab attached.");
}
}
public void Update()
{
if (!Input.GetMouseButtonUp(0))
{
return;
}
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out var hitInfo, 200f))
{
Debug.DrawLine(ray.origin, hitInfo.point, Color.red);
EasyDecal easyDecal = EasyDecal.ProjectAt(DecalPrefab.gameObject, hitInfo.collider.gameObject, hitInfo.point, hitInfo.normal);
t = !t;
if (t)
{
easyDecal.CancelFade();
}
}
}
}
|