Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/MegaVertColSelect.cs
2026-02-21 16:45:37 +08:00

72 lines
1.2 KiB
C#

using UnityEngine;
[AddComponentMenu("Modifiers/Selection/Vert Color")]
public class MegaVertColSelect : MegaSelectionMod
{
public MegaChannel channel;
private float[] modselection;
public float gizSize = 0.01f;
public bool displayWeights = true;
public float weight = 1f;
public float threshold;
public bool update = true;
public override MegaModChannel ChannelsReq()
{
return MegaModChannel.Col;
}
public override string ModName()
{
return "Vert Color Select";
}
public override string GetHelpURL()
{
return "?page_id=1305";
}
public float[] GetSel()
{
return modselection;
}
public override void GetSelection(MegaModifiers mc)
{
if (!ModEnabled)
{
return;
}
if (modselection == null || modselection.Length != mc.verts.Length)
{
modselection = new float[mc.verts.Length];
}
if (update)
{
update = false;
if (mc.cols != null && mc.cols.Length > 0)
{
int index = (int)channel;
for (int i = 0; i < mc.verts.Length; i++)
{
modselection[i] = (mc.cols[i][index] - threshold) / (1f - threshold) * weight;
}
}
else
{
for (int j = 0; j < mc.verts.Length; j++)
{
modselection[j] = weight;
}
}
}
mc.selection = modselection;
}
}