波形这块对了,还剩下错误判定还有一堆细节
This commit is contained in:
@@ -2306,6 +2306,7 @@ GameObject:
|
||||
- component: {fileID: 144553465}
|
||||
- component: {fileID: 144553464}
|
||||
- component: {fileID: 144553463}
|
||||
- component: {fileID: 144553466}
|
||||
m_Layer: 5
|
||||
m_Name: SocketEmo
|
||||
m_TagString: Untagged
|
||||
@@ -2383,6 +2384,22 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 144553461}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &144553466
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 144553461}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b7407f67123179648be95c4ebf1d6281, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
waveformType: 1
|
||||
isCorrect: 0
|
||||
randomShift: 0
|
||||
initialRandomPhase: 0
|
||||
--- !u!1 &145192917
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5710,7 +5727,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!4 &302414626
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -7948,7 +7965,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1280074085165228861, guid: e0b9abce827101741b53fc58924e58ab, type: 3}
|
||||
propertyPath: wholeNumbers
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1280074086019734160, guid: e0b9abce827101741b53fc58924e58ab, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
@@ -8894,6 +8911,7 @@ GameObject:
|
||||
- component: {fileID: 585617293}
|
||||
- component: {fileID: 585617292}
|
||||
- component: {fileID: 585617291}
|
||||
- component: {fileID: 585617294}
|
||||
m_Layer: 5
|
||||
m_Name: SocketColor
|
||||
m_TagString: Untagged
|
||||
@@ -8971,6 +8989,22 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 585617289}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &585617294
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 585617289}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b7407f67123179648be95c4ebf1d6281, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
waveformType: 6
|
||||
isCorrect: 0
|
||||
randomShift: 0
|
||||
initialRandomPhase: 0
|
||||
--- !u!1 &587433358
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -11684,9 +11718,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: b7407f67123179648be95c4ebf1d6281, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
waveformType: 1
|
||||
waveformType: 3
|
||||
isCorrect: 0
|
||||
errorWaveformType: 6
|
||||
randomShift: 0
|
||||
initialRandomPhase: 0
|
||||
--- !u!1 &708923414
|
||||
@@ -16369,7 +16402,6 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
waveformVisualizer: {fileID: 1424895148}
|
||||
errorWaveformVisualizer: {fileID: 302414629}
|
||||
phaseSlider: {fileID: 590855577}
|
||||
--- !u!1 &1141076858
|
||||
GameObject:
|
||||
@@ -18396,7 +18428,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
waveformType: 2
|
||||
isCorrect: 0
|
||||
errorWaveformType: 6
|
||||
randomShift: 0
|
||||
initialRandomPhase: 0
|
||||
--- !u!1 &1272879182
|
||||
@@ -21853,7 +21884,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
waveformType: 0
|
||||
isCorrect: 0
|
||||
errorWaveformType: 6
|
||||
randomShift: 0
|
||||
initialRandomPhase: 0
|
||||
--- !u!1 &1476216892
|
||||
@@ -24251,6 +24281,18 @@ PrefabInstance:
|
||||
propertyPath: m_SortingOrder
|
||||
value: 7
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3604128570690997016, guid: 6503ec55f53f1ae47be0b15b1c325375, type: 3}
|
||||
propertyPath: m_Positions.Array.size
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3604128570690997016, guid: 6503ec55f53f1ae47be0b15b1c325375, type: 3}
|
||||
propertyPath: m_Positions.Array.data[0].y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3604128570690997016, guid: 6503ec55f53f1ae47be0b15b1c325375, type: 3}
|
||||
propertyPath: m_Positions.Array.data[1].y
|
||||
value: 1.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5276442643334587860, guid: 6503ec55f53f1ae47be0b15b1c325375, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
@@ -31258,7 +31300,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
waveformType: 0
|
||||
isCorrect: 1
|
||||
errorWaveformType: 6
|
||||
randomShift: 0
|
||||
initialRandomPhase: 0
|
||||
--- !u!1 &2033809932
|
||||
|
||||
@@ -48,7 +48,7 @@ public class OscilloscopeController : MonoBehaviour
|
||||
|
||||
if (!targetData.isCorrect)
|
||||
{
|
||||
waveformVisualizer.SetError();
|
||||
waveformVisualizer.SetError(targetData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ public class TargetPointData : MonoBehaviour
|
||||
public int randomShift;
|
||||
[HideInInspector]
|
||||
public float initialRandomPhase; // 随机初始相位
|
||||
[HideInInspector]
|
||||
public int spikeIndex=-1;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
@@ -55,6 +55,9 @@ public class WaveformVisualizer : MonoBehaviour
|
||||
private bool isCorrect=true;
|
||||
|
||||
private bool isSpikeIndexSet = false; // 标志位,判断 spikeIndex 是否已设置
|
||||
private TargetPointData targetdata;
|
||||
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -130,7 +133,12 @@ public class WaveformVisualizer : MonoBehaviour
|
||||
|
||||
}
|
||||
private void GenerateErrorData()
|
||||
{
|
||||
{
|
||||
if(targetdata.spikeIndex!=-1)
|
||||
{
|
||||
spikeIndex=targetdata.spikeIndex;
|
||||
return;
|
||||
}
|
||||
if (isSpikeIndexSet) return; // 如果已设置,则不再随机
|
||||
|
||||
float threshold = 0.9f; // 80% 的阈值
|
||||
@@ -166,11 +174,18 @@ private void GenerateErrorData()
|
||||
{
|
||||
spikeIndex = 0; // 如果没有找到满足条件的点,则默认为 0
|
||||
isSpikeIndexSet = true; // 即使没有找到满足条件的点,也将标志位设为 true
|
||||
|
||||
|
||||
}
|
||||
if(targetdata!=null)
|
||||
{
|
||||
targetdata.spikeIndex=spikeIndex;
|
||||
}
|
||||
}
|
||||
public void SetError()
|
||||
public void SetError(TargetPointData target)
|
||||
{
|
||||
isCorrect=false;
|
||||
targetdata=target;
|
||||
}
|
||||
float GetWaveformValue(float t, float phaseOffset)
|
||||
{
|
||||
@@ -271,5 +286,6 @@ private void GenerateErrorData()
|
||||
spikeIndex=0;
|
||||
isCorrect=true;
|
||||
isSpikeIndexSet = false;
|
||||
targetdata=null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user