fix:修改触发体感服脚本

This commit is contained in:
bzx
2025-08-13 17:31:33 +08:00
parent 5811417b02
commit 2a314f1ad5
2 changed files with 12 additions and 8 deletions

View File

@@ -167,7 +167,10 @@ public class TrueGearEffectManager : MonoBehaviour
)
{
string indexStr = string.Join(",", motorIndex);
bool isOne=actionType != "Shake";
if (!isOne)
endTime = 0;
Debug.Log(indexStr);
string json = $@"
{{
""name"":""{effectName}"",
@@ -183,12 +186,13 @@ public class TrueGearEffectManager : MonoBehaviour
""end_intensity"":{endIntensity},
""intensity_mode"":""{intensityMode}"",
""action_type"":""{actionType}"",
""once"":""False"",
""interval"":0,
""once"":""True"",
""interval"":1,
""index"":[{indexStr}]
}}
]
}}";
SendPlayEffectByContent(json);
}
@@ -199,7 +203,6 @@ public class TrueGearEffectManager : MonoBehaviour
Debug.Log("OnTestClick" + res);
if (!res)
return;
androidConnector.SendPlayEffectByContent(jsonStr);
}
public List<string> hitParts=new List<string>();
@@ -226,18 +229,19 @@ public class TrueGearEffectManager : MonoBehaviour
motorIDs.AddRange(isUp?new int[] { 2,3,6,7}: new int[] { 102, 103, 106,107 }); break;
case "rightDown":
motorIDs.AddRange(isUp?new int[] { 10,11,14,15}: new int[] { 114, 115, 118,119 }); break;
case "rightAim":
Debug.Log("xxzz");
motorIDs.AddRange(new int[] { 0,100}); break;
default:
motorIDs.Add(0); break;
}
if(isArm)
motorIDs.Add(0);
PlayVibrationEffect(
effectName: $"Hit_{hitPart}",
motorIndex: motorIDs,
startIntensity: 50,
endIntensity: 50,
endTime: 400,
actionType:isArm? "elect" :"shack"
actionType: isArm? "Electrical" :"Shake"
);
}
}