add some extra assets FX and SFX

This commit is contained in:
Robii Aragon
2026-03-29 23:03:14 -07:00
parent 6ef3eb1535
commit 24dc66a81e
10142 changed files with 2535978 additions and 36608 deletions

View File

@@ -0,0 +1,90 @@
using UnityEngine;
namespace NaughtyWaterBuoyancy.Editor
{
public class WaterMeshGenerator
{
private static int rows;
private static int columns;
private static float quadSegmentSize;
public static Mesh GenerateMesh(int _rows, int _columns, float _quadSegmentSize)
{
if (_rows < 0f || _columns < 0 || _quadSegmentSize < 0f)
{
throw new System.ArgumentException("Invalid water mesh data");
}
rows = _rows + 1; // There are 2 rows between 3 points, so we need to add 1
columns = _columns + 1; // Same here
quadSegmentSize = _quadSegmentSize;
var mesh = new Mesh();
mesh.name = "Water Mesh";
MeshData meshData = new MeshData();
meshData.Vertices = new Vector3[rows * columns];
meshData.Normals = new Vector3[rows * columns];
meshData.UVs = new Vector2[rows * columns];
meshData.TriangleIndices = new int[rows * columns * 6];
int triangleIndex = 0;
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < columns; c++)
{
int index = GetIndex(r, c);
// Set vertices, normals and UVs
meshData.Vertices[index] = new Vector3(c * quadSegmentSize, 0f, r * quadSegmentSize);
meshData.Normals[index] = Vector3.up;
meshData.UVs[index] = new Vector2((float)c / columns, (float)r / rows);
// Set triangles
if (r < rows - 1 && c < columns - 1)
{
meshData.TriangleIndices[triangleIndex + 0] = GetIndex(r, c);
meshData.TriangleIndices[triangleIndex + 1] = GetIndex(r + 1, c);
meshData.TriangleIndices[triangleIndex + 2] = GetIndex(r, c + 1);
meshData.TriangleIndices[triangleIndex + 3] = GetIndex(r + 1, c);
meshData.TriangleIndices[triangleIndex + 4] = GetIndex(r + 1, c + 1);
meshData.TriangleIndices[triangleIndex + 5] = GetIndex(r, c + 1);
triangleIndex += 6;
}
}
}
mesh.vertices = meshData.Vertices;
mesh.normals = meshData.Normals;
mesh.uv = meshData.UVs;
mesh.triangles = meshData.TriangleIndices;
return mesh;
}
private static int GetIndex(int row, int column)
{
return row * columns + column;
}
private static int GetRow(int vertexIndex)
{
return vertexIndex / columns;
}
private static int GetColumn(int vertexIndex)
{
return vertexIndex % columns;
}
private struct MeshData
{
public Vector3[] Vertices { get; set; }
public Vector3[] Normals { get; set; }
public Vector2[] UVs { get; set; }
public int[] TriangleIndices { get; set; }
}
}
}

View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 1f16f89f10f6e1a4e933fc2824f43785
timeCreated: 1673260982
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
2.5D
packageVersion: 3.77h
assetPath: Assets/Game Kit Controller/Integrations/NaughtyWaterBuoyancy/Scripts/Editor/WaterMeshGenerator.cs
uploadId: 889948

View File

@@ -0,0 +1,219 @@
using UnityEditor;
using UnityEngine;
namespace NaughtyWaterBuoyancy.Editor
{
[CustomEditor (typeof(WaterVolume))]
public class WaterVolumeEditor : UnityEditor.Editor
{
private SerializedProperty waterHeight;
private WaterVolume waterVolumeTarget;
private SerializedProperty density;
private SerializedProperty rows;
private SerializedProperty columns;
private SerializedProperty quadSegmentSize;
private SerializedProperty useCustomGravityForce;
private SerializedProperty gravityForce;
private SerializedProperty objectLayermask;
private SerializedProperty checkObjectByTag;
private SerializedProperty tagListToCheck;
private SerializedProperty checkForFloatingObjectSocketEnabled;
SerializedProperty showDebugPrint;
SerializedProperty showGizmo;
WaterVolume manager;
// [MenuItem ("NaughtyWaterBouyancy/Create Water Mesh")]
// private static void CreateMesh ()
// {
// Mesh mesh = WaterMeshGenerator.GenerateMesh (5, 5, 1f);
// AssetDatabase.CreateAsset (mesh, "Assets/NaughtyWaterBuoyancy/Models/Water Mesh.asset");
// }
protected virtual void OnEnable ()
{
this.waterVolumeTarget = (WaterVolume)this.target;
this.waterHeight = this.serializedObject.FindProperty ("waterHeight");
this.density = this.serializedObject.FindProperty ("density");
this.rows = this.serializedObject.FindProperty ("rows");
this.columns = this.serializedObject.FindProperty ("columns");
this.quadSegmentSize = this.serializedObject.FindProperty ("quadSegmentSize");
this.useCustomGravityForce = this.serializedObject.FindProperty ("useCustomGravityForce");
this.gravityForce = this.serializedObject.FindProperty ("gravityForce");
this.objectLayermask = this.serializedObject.FindProperty ("objectLayermask");
this.checkObjectByTag = this.serializedObject.FindProperty ("checkObjectByTag");
this.tagListToCheck = this.serializedObject.FindProperty ("tagListToCheck");
this.checkForFloatingObjectSocketEnabled = this.serializedObject.FindProperty ("checkForFloatingObjectSocketEnabled");
this.showDebugPrint = this.serializedObject.FindProperty ("showDebugPrint");
this.showGizmo = this.serializedObject.FindProperty ("showGizmo");
Undo.undoRedoPerformed += this.OnUndoRedoPerformed;
manager = (WaterVolume)target;
}
protected virtual void OnDisable ()
{
Undo.undoRedoPerformed -= this.OnUndoRedoPerformed;
}
public override void OnInspectorGUI ()
{
this.serializedObject.Update ();
EditorGUILayout.Space ();
EditorGUI.BeginChangeCheck ();
EditorGUILayout.PropertyField (this.waterHeight);
EditorGUILayout.PropertyField (this.rows);
EditorGUILayout.PropertyField (this.columns);
EditorGUILayout.PropertyField (this.quadSegmentSize);
EditorGUILayout.PropertyField (this.useCustomGravityForce);
EditorGUILayout.PropertyField (this.gravityForce);
if (EditorGUI.EndChangeCheck ()) {
this.rows.intValue = Mathf.Max (1, this.rows.intValue);
this.columns.intValue = Mathf.Max (1, this.columns.intValue);
this.quadSegmentSize.floatValue = Mathf.Max (0f, this.quadSegmentSize.floatValue);
if (!Application.isPlaying) {
this.UpdateMesh (this.rows.intValue, this.columns.intValue, this.quadSegmentSize.floatValue);
this.UpdateBoxCollider (this.rows.intValue, this.columns.intValue, this.quadSegmentSize.floatValue);
}
}
EditorGUILayout.PropertyField (this.density);
EditorGUILayout.Space ();
EditorGUILayout.PropertyField (this.objectLayermask);
EditorGUILayout.PropertyField (this.checkObjectByTag);
if (this.checkObjectByTag.boolValue) {
EditorGUILayout.Space ();
showSimpleList (this.tagListToCheck);
}
EditorGUILayout.PropertyField (this.checkForFloatingObjectSocketEnabled);
EditorGUILayout.Space ();
EditorGUILayout.PropertyField (this.showDebugPrint);
EditorGUILayout.PropertyField (this.showGizmo);
EditorGUILayout.Space ();
EditorGUILayout.Space ();
if (GUILayout.Button ("Update System")) {
if (!Application.isPlaying) {
this.UpdateMesh (this.rows.intValue, this.columns.intValue, this.quadSegmentSize.floatValue);
this.UpdateBoxCollider (this.rows.intValue, this.columns.intValue, this.quadSegmentSize.floatValue);
}
}
this.serializedObject.ApplyModifiedProperties ();
}
private void UpdateMesh (int rows, int columns, float quadSegmentSize)
{
MeshFilter meshFilter = this.waterVolumeTarget.GetComponent<MeshFilter> ();
Mesh oldMesh = meshFilter.sharedMesh;
Mesh newMesh = WaterMeshGenerator.GenerateMesh (rows, columns, quadSegmentSize);
newMesh.name = "Water Mesh Instance";
meshFilter.sharedMesh = newMesh;
EditorUtility.SetDirty (meshFilter);
if (oldMesh != null && !AssetDatabase.Contains (oldMesh)) {
DestroyImmediate (oldMesh);
}
}
private void UpdateBoxCollider (int rows, int columns, float quadSegmentSize)
{
var boxCollider = this.waterVolumeTarget.GetComponent<BoxCollider> ();
if (boxCollider != null) {
Vector3 size = new Vector3 (columns * quadSegmentSize, waterHeight.floatValue, rows * quadSegmentSize);
boxCollider.size = size;
Vector3 center = size / 2f;
center.y *= -1f;
boxCollider.center = center;
EditorUtility.SetDirty (boxCollider);
}
}
private void OnUndoRedoPerformed ()
{
this.UpdateMesh (this.waterVolumeTarget.Rows, this.waterVolumeTarget.Columns, this.waterVolumeTarget.QuadSegmentSize);
this.UpdateBoxCollider (this.waterVolumeTarget.Rows, this.waterVolumeTarget.Columns, this.waterVolumeTarget.QuadSegmentSize);
}
void showSimpleList (SerializedProperty list)
{
EditorGUILayout.Space ();
if (GUILayout.Button ("Show/Hide " + list.displayName)) {
list.isExpanded = !list.isExpanded;
}
EditorGUILayout.Space ();
if (list.isExpanded) {
GUILayout.BeginHorizontal ();
if (GUILayout.Button ("Add")) {
list.arraySize++;
}
if (GUILayout.Button ("Clear")) {
list.arraySize = 0;
}
GUILayout.EndHorizontal ();
EditorGUILayout.Space ();
for (int i = 0; i < list.arraySize; i++) {
GUILayout.BeginHorizontal ();
if (i < list.arraySize && i >= 0) {
EditorGUILayout.PropertyField (list.GetArrayElementAtIndex (i), new GUIContent ("", null, ""), false);
}
GUILayout.BeginHorizontal ();
if (GUILayout.Button ("x")) {
list.DeleteArrayElementAtIndex (i);
return;
}
if (GUILayout.Button ("v")) {
if (i >= 0) {
list.MoveArrayElement (i, i + 1);
}
}
if (GUILayout.Button ("^")) {
if (i < list.arraySize) {
list.MoveArrayElement (i, i - 1);
}
}
GUILayout.EndHorizontal ();
GUILayout.EndHorizontal ();
}
}
}
}
}

View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: c2872cce0a936bb4ba5f6411a4abf1b5
timeCreated: 1673260982
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
2.5D
packageVersion: 3.77h
assetPath: Assets/Game Kit Controller/Integrations/NaughtyWaterBuoyancy/Scripts/Editor/WaterVolumeEditor.cs
uploadId: 889948