-
Notifications
You must be signed in to change notification settings - Fork 112
/
listen for an event.cs
34 lines (31 loc) · 1.03 KB
/
listen for an event.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
32
33
34
using UnityEngine;
namespace Mod
{
public class Mod
{
public static void Main()
{
// listen for the event that is fired when wires are created
ModAPI.OnWireCreated += (sender, wire) => {
// check if it is a spring cable
if (wire is SpringCableBehaviour)
{
// make it red
wire.SetColor(Color.red);
// make it thinner
wire.SetThickness(0.05f);
}
};
// listen for the event that is fired when something is killed
ModAPI.OnDeath += (sender, being) => {
//notify player of their action
ModAPI.Notify("this is really immoral");
};
// listen for gunshot event
ModAPI.OnGunShot += (sender, gun) => {
//notify player what round the gun uses
ModAPI.Notify(gun.Cartridge.name);
};
}
}
}