mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
[PropLoadingHexagon] Initial release
This commit is contained in:
parent
4307d85329
commit
a5e5b05ab8
11 changed files with 372 additions and 325 deletions
36
PropLoadingHexagon/Integrations/ClappableLoadingHex.cs
Normal file
36
PropLoadingHexagon/Integrations/ClappableLoadingHex.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using NAK.PropLoadingHexagon.Components;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.PropLoadingHexagon.Integrations;
|
||||
|
||||
public static class TheClapperIntegration
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
PropLoadingHexagonMod.OnPropPlaceholderCreated += (placeholder) =>
|
||||
{
|
||||
if (placeholder.TryGetComponent(out LoadingHexagonController loadingHexagon))
|
||||
ClappableLoadingHex.Create(loadingHexagon);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class ClappableLoadingHex : Kafe.TheClapper.Clappable
|
||||
{
|
||||
private LoadingHexagonController _loadingHexagon;
|
||||
|
||||
public override void OnClapped(Vector3 clappablePosition)
|
||||
{
|
||||
if (_loadingHexagon == null) return;
|
||||
_loadingHexagon.IsLoadingCanceled = true;
|
||||
Kafe.TheClapper.TheClapper.EmitParticles(clappablePosition, new Color(1f, 1f, 0f), 2f); // why this internal
|
||||
}
|
||||
|
||||
public static void Create(LoadingHexagonController loadingHexagon)
|
||||
{
|
||||
GameObject target = loadingHexagon.gameObject;
|
||||
if (!target.gameObject.TryGetComponent(out ClappableLoadingHex clappableHexagon))
|
||||
clappableHexagon = target.gameObject.AddComponent<ClappableLoadingHex>();
|
||||
clappableHexagon._loadingHexagon = loadingHexagon;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue