RegularGridFloor

This commit is contained in:
SoulliesOfficial
2026-07-08 04:28:51 -04:00
parent bdb3d40287
commit 879f1e49b8
12 changed files with 908 additions and 39 deletions

View File

@@ -100,9 +100,9 @@ MonoBehaviour:
m_GameObject: {fileID: 8220859051912764878}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b73aa7982dc9e4261b2ff45db0112d48, type: 3}
m_Script: {fileID: 11500000, guid: 8fe763000f430ea498bfc8d7883bda31, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Ichni.RhythmGame.EnvironmentObject
m_EditorClassIdentifier: Assembly-CSharp::Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.DTMRegularGridFloor
serializationData:
SerializedFormat: 2
SerializedBytes:
@@ -142,3 +142,14 @@ MonoBehaviour:
themeBundleName:
objectName:
isStatic: 0
gridSizeX: 100
gridSizeY: 100
gridDensity: 1
lineThickness: 0.05
edgeSoftness: 0
moveVectorX: 0
moveVectorY: 0
enableOuterBorder: 1
outerBorderColor: {r: 1, g: 1, b: 1, a: 1}
outerBorderWidth: 0.005
meshRenderer: {fileID: 8033154349789972278}

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
{
[System.Serializable]
public class DTMRegularGridFloor_BM : EnvironmentObject_BM
{
public float gridSizeX = 100f;
public float gridSizeY = 100f;
public float gridDensity = 1f;
public float lineThickness = 0.05f;
public float edgeSoftness;
public float moveVectorX;
public float moveVectorY;
public bool enableOuterBorder = true;
public float outerBorderColorR = 1f;
public float outerBorderColorG = 1f;
public float outerBorderColorB = 1f;
public float outerBorderColorA = 1f;
public float outerBorderWidth = 0.005f;
public DTMRegularGridFloor_BM()
{
}
public DTMRegularGridFloor_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement,
string themeBundleName, string objectName, bool isStatic,
float gridSizeX, float gridSizeY, float gridDensity,
float lineThickness, float edgeSoftness, float moveVectorX, float moveVectorY,
bool enableOuterBorder, Color outerColor, float outerBorderWidth)
: base(elementName, elementGuid, tags, attachedElement, themeBundleName, objectName, isStatic)
{
this.gridSizeX = gridSizeX;
this.gridSizeY = gridSizeY;
this.gridDensity = gridDensity;
this.lineThickness = lineThickness;
this.edgeSoftness = edgeSoftness;
this.moveVectorX = moveVectorX;
this.moveVectorY = moveVectorY;
this.enableOuterBorder = enableOuterBorder;
this.outerBorderColorR = outerColor.r;
this.outerBorderColorG = outerColor.g;
this.outerBorderColorB = outerColor.b;
this.outerBorderColorA = outerColor.a;
this.outerBorderWidth = outerBorderWidth;
}
public override void ExecuteBM()
{
Color outerColor = new Color(outerBorderColorR, outerBorderColorG, outerBorderColorB, outerBorderColorA);
matchedElement = DTMRegularGridFloor.GenerateElement(elementName, elementGuid, tags, false,
themeBundleName, objectName, GetElement(attachedElementGuid), isStatic,
gridSizeX, gridSizeY, gridDensity,
lineThickness, edgeSoftness, moveVectorX, moveVectorY,
enableOuterBorder, outerColor, outerBorderWidth);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 09450fa65de643d9bb82781245aeca51

View File

@@ -0,0 +1,39 @@
using Ichni.Editor;
using Ichni.RhythmGame.Beatmap;
using Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap;
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public partial class DTMRegularGridFloor
{
#region [Editor] Inspection & Save
public override void SaveBM()
{
matchedBM = new DTMRegularGridFloor_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
themeBundleName, objectName, isStatic,
gridSizeX, gridSizeY, gridDensity,
lineThickness, edgeSoftness, moveVectorX, moveVectorY,
enableOuterBorder, outerBorderColor, outerBorderWidth);
}
public override void SetUpInspector()
{
base.SetUpInspector();
InspectorBuilder.For(this)
.Section("DTMRegularGridFloor")
.Slider(nameof(gridSizeX), 1, 500, "Grid Size X").OnChanged(UpdateMaterialProperties)
.Slider(nameof(gridSizeY), 1, 500, "Grid Size Y").OnChanged(UpdateMaterialProperties)
.Slider(nameof(gridDensity), 0.1f, 10, "Grid Density").OnChanged(UpdateMaterialProperties)
.Slider(nameof(lineThickness), 0.001f, 0.5f, "Line Thickness").OnChanged(UpdateMaterialProperties)
.Slider(nameof(edgeSoftness), 0, 0.5f, "Edge Softness").OnChanged(UpdateMaterialProperties)
.Slider(nameof(moveVectorX), -10, 10, "Move Vector X").OnChanged(UpdateMaterialProperties)
.Slider(nameof(moveVectorY), -10, 10, "Move Vector Y").OnChanged(UpdateMaterialProperties)
.Toggle(nameof(enableOuterBorder), "Enable Outer Border").OnChanged(UpdateMaterialProperties)
.ColorPicker(nameof(outerBorderColor), "Outer Border Color").OnChanged(UpdateMaterialProperties)
.Slider(nameof(outerBorderWidth), 0, 0.5f, "Outer Border Width").OnChanged(UpdateMaterialProperties)
.Build();
}
#endregion
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a5d1dc0749334cf6ac0c25191271bc22

View File

@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public partial class DTMRegularGridFloor : EnvironmentObject
{
#region Exposed Fields
public float gridSizeX = 100f;
public float gridSizeY = 100f;
public float gridDensity = 1f;
public float lineThickness = 0.05f;
public float edgeSoftness;
public float moveVectorX;
public float moveVectorY;
public bool enableOuterBorder = true;
public Color outerBorderColor = Color.white;
public float outerBorderWidth = 0.005f;
public Renderer meshRenderer;
#endregion
#region Lifecycle & Factory
public static DTMRegularGridFloor GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
bool isStatic,
float gridSizeX, float gridSizeY, float gridDensity,
float lineThickness, float edgeSoftness, float moveVectorX, float moveVectorY,
bool enableOuterBorder, Color outerBorderColor, float outerBorderWidth)
{
DTMRegularGridFloor regularGridFloor = EnvironmentObject.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<DTMRegularGridFloor>();
regularGridFloor.gridSizeX = gridSizeX;
regularGridFloor.gridSizeY = gridSizeY;
regularGridFloor.gridDensity = gridDensity;
regularGridFloor.lineThickness = lineThickness;
regularGridFloor.edgeSoftness = edgeSoftness;
regularGridFloor.moveVectorX = moveVectorX;
regularGridFloor.moveVectorY = moveVectorY;
regularGridFloor.enableOuterBorder = enableOuterBorder;
regularGridFloor.outerBorderColor = outerBorderColor;
regularGridFloor.outerBorderWidth = outerBorderWidth;
return regularGridFloor;
}
public override void FirstSetUpObject(bool isFirstGenerated)
{
if (meshRenderer == null)
meshRenderer = GetComponentInChildren<Renderer>();
meshRenderer.InitializeShader();
}
public override void AfterInitialize()
{
UpdateMaterialProperties();
}
public override void OnDirtyRefresh(Dictionary<string, bool> flags)
{
UpdateMaterialProperties();
}
#endregion
#region Core Effect Logic
public void UpdateMaterialProperties()
{
if (meshRenderer != null && meshRenderer.material != null)
{
Material mat = meshRenderer.material;
mat.SetVector("_GridSize", new Vector4(gridSizeX, gridSizeY, 0f, 0f));
mat.SetFloat("_GridDensity", gridDensity);
mat.SetFloat("_LineThickness", lineThickness);
mat.SetFloat("_EdgeSoftness", edgeSoftness);
mat.SetVector("_MoveVector", new Vector4(moveVectorX, moveVectorY, 0f, 0f));
float borderOn = enableOuterBorder ? 1f : 0f;
mat.SetFloat("_EnableOuterBorder", borderOn);
if (enableOuterBorder)
{
mat.EnableKeyword("_OUTER_BORDER_ON");
}
else
{
mat.DisableKeyword("_OUTER_BORDER_ON");
}
mat.SetColor("_OuterBorderColor", outerBorderColor);
mat.SetFloat("_OuterBorderWidth", outerBorderWidth);
mat.SetColor("_Color0", colorSubmodule.currentBaseColor);
}
}
public override void Refresh()
{
base.Refresh();
if (meshRenderer != null)
{
meshRenderer.material.SetColor("_Color0", colorSubmodule.currentBaseColor);
}
}
#endregion
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8fe763000f430ea498bfc8d7883bda31