-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.cs
56 lines (48 loc) · 1.53 KB
/
Main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using SALT;
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace InfiniteJump
{
public class Main : ModEntryPoint
{
// THE EXECUTING ASSEMBLY
public static Assembly execAssembly;
// Called before MainScript.Awake
// You want to register new things and enum values here, as well as do all your harmony patching
public override void PreLoad()
{
// Gets the Assembly being executed
execAssembly = Assembly.GetExecutingAssembly();
HarmonyInstance.PatchAll(execAssembly);
}
// Called before MainScript.Start
// Used for registering things that require a loaded gamecontext
public override void Load()
{
UserInputService.Instance.InputBegan += InputBegan;
}
// Called after all mods Load's have been called
// Used for editing existing assets in the game, not a registry step
public override void PostLoad()
{
}
private static List<KeyCode> jumpKeys = new List<KeyCode>
{
KeyCode.Space,
KeyCode.W,
KeyCode.UpArrow
};
public void InputBegan(UserInputService.InputObject inputObject, bool wasProcessed)
{
if (jumpKeys.Contains(inputObject.keyCode))
{
PlayerScript.player.canJump = true;
PlayerScript.player.JumpTrigger();
}
}
}
}