-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollectible.cs
31 lines (28 loc) · 1.17 KB
/
Collectible.cs
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
using UnityEngine;
using UdonSharp;
using UwUtils;
namespace UwUtils
{
[AddComponentMenu("UwUtils/Collectible")]
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class Collectible : UdonSharpBehaviour
{
[Space]
[SerializeField] private bool disableSelfOnCollect = true;
[SerializeField] private CollectionSystem CollectionSystemRef;
[SerializeField] private int Value = 10;
[Space]
[SerializeField] private bool enableLogging = true;
void Start()
{
CollectionSystemRef._totalValueDebug(Value);
if(enableLogging) Debug.Log("[Reava_/UwUtils/Collectible.cs]: Collectible initialized for " + Value + " points, ref to " + CollectionSystemRef + ". Collectible is :" + gameObject.name, gameObject);
}
public void Interact()
{
CollectionSystemRef._collectValue(Value);
if (enableLogging) Debug.Log("[Reava_/UwUtils/Collectible.cs]: Collectible claimed for " + Value + " points sent to "+ CollectionSystemRef+" from:" + gameObject.name, gameObject);
if (disableSelfOnCollect) this.gameObject.SetActive(false);
}
}
}