Organize custom scripts and Shared under Assets/Scripts, and delete assembly definition files

This commit is contained in:
2026-07-01 20:36:56 +07:00
parent befc19bf37
commit 01048074ee
183 changed files with 180 additions and 3456 deletions

View File

@@ -0,0 +1,65 @@
using System;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Baba_yaga.GameSetup.Maze.Native
{
[UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "Hallucinate.GameSetup.Maze.Native", sourceAssembly: "Opsive.UltimateCharacterController")]
public class NativeNoiseProvider : IDisposable
{
private const string DLL_NAME = "BackroomsNoise";
[DllImport(DLL_NAME)]
private static extern IntPtr CreateNoiseGenerator(int seed, float frequency, int noiseType);
[DllImport(DLL_NAME)]
private static extern float GetNoiseValue(IntPtr handle, float x, float z);
[DllImport(DLL_NAME)]
private static extern void GetNoiseBuffer(IntPtr handle, float startX, float startZ, int width, int depth, float[] buffer);
[DllImport(DLL_NAME)]
private static extern void DestroyNoiseGenerator(IntPtr handle);
private IntPtr _handle;
public bool IsInitialized => _handle != IntPtr.Zero;
public NativeNoiseProvider(int seed, float frequency = 0.01f, int noiseType = 0)
{
try
{
_handle = CreateNoiseGenerator(seed, frequency, noiseType);
}
catch (DllNotFoundException)
{
Debug.LogWarning($"Native library '{DLL_NAME}' not found. Ensure it is compiled and placed in Plugins folder.");
}
}
public float GetNoise(float x, float z)
{
if (!IsInitialized) return 0f;
return GetNoiseValue(_handle, x, z);
}
public void FillBuffer(float startX, float startZ, int width, int depth, float[] buffer)
{
if (!IsInitialized || buffer == null) return;
GetNoiseBuffer(_handle, startX, startZ, width, depth, buffer);
}
public void Dispose()
{
if (IsInitialized)
{
DestroyNoiseGenerator(_handle);
_handle = IntPtr.Zero;
}
}
~NativeNoiseProvider()
{
Dispose();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4fd030227a1b87a4f8826f9b317fbf87