36 lines
899 B
C#
36 lines
899 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
using HarmonyLib;
|
|
|
|
namespace ScarletMansion.GamePatch {
|
|
public class DoorLockPatch {
|
|
|
|
[HarmonyPatch(typeof(DoorLock), "Awake")]
|
|
[HarmonyPostfix]
|
|
public static void AwakePatch(ref DoorLock __instance){
|
|
var scarlet = __instance as Components.ScarletDoorLock;
|
|
scarlet?.AwakeScarlet();
|
|
}
|
|
|
|
[HarmonyPatch(typeof(DoorLock), "OnTriggerStay")]
|
|
[HarmonyPrefix]
|
|
public static bool OnTriggerStayPatch(ref DoorLock __instance, Collider other){
|
|
var scarlet = __instance as Components.ScarletDoorLock;
|
|
if (scarlet){
|
|
if (!scarlet.callNormalScript) {
|
|
scarlet.OnTriggerStayScarlet(other);
|
|
return false;
|
|
}
|
|
scarlet.callNormalScript = false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
}
|
|
}
|