-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathGadgetHookScript.cs
More file actions
33 lines (32 loc) · 899 Bytes
/
Copy pathGadgetHookScript.cs
File metadata and controls
33 lines (32 loc) · 899 Bytes
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
using GadgetCore.API;
using UnityEngine;
namespace GadgetCore
{
/// <summary>
/// This component is used to hook a Gadget into Unity's update cycle.
/// </summary>
public class GadgetHookScript : MonoBehaviour
{
/// <summary>
/// The GadgetInfo that is updated by this hook script.
/// </summary>
public GadgetInfo Mod { get; internal set; }
internal void Start()
{
if (Mod == null || Mod.Gadget == null)
{
DestroyImmediate(this);
return;
}
if (Mod.Gadget.Enabled) Mod.Gadget.ScriptStart();
}
internal void Update()
{
if (Mod.Gadget.Enabled) Mod.Gadget.ScriptUpdate();
}
internal void FixedUpdate()
{
if (Mod.Gadget.Enabled) Mod.Gadget.ScriptFixedUpdate();
}
}
}