public static void StimulateArmBurst(StimulationInfo info, int duration) { if (instance) { instance.StartCoroutine(instance.stimulateBurst(new StimulationInfo[] { info }, duration)); } }
protected virtual void HandleImpact(Message msg) { VectorPayload payload = JsonUtility.FromJson <VectorPayload>(msg.payload); if (payload.vector.Equals(Vector3.down)) { StimulationInfo[] infos = new StimulationInfo[] { new StimulationInfo( Part.Triceps, Side.Right, impactWidth, currentTriceps ), new StimulationInfo( Part.Triceps, Side.Left, impactWidth, currentTriceps ), }; // Ramp up shortly ArmStimulation.StimulateArmBurst( infos, impactDuration ); } }
public void HandleBoxLedgeMsg(Message msg) { if (ledgeDuration > 0) { Debug.Log("Ledge"); int current = 15; StimulationInfo[] infos = new StimulationInfo[] { new StimulationInfo( Part.Wrist, Side.Right, //Side.Left, // Wrist extensor ledgeWidthWrist, current ), new StimulationInfo( Part.Shoulder, Side.Right, ledgeWidthShoulder, currentWrist ), }; // Ramp up shortly ArmStimulation.StimulateArmBurst( infos, ledgeDuration ); } }
public override void InitParameters(string payloadString) { PunchCubePayload payload = JsonUtility.FromJson <PunchCubePayload>(payloadString); side = payload.side; Debug.Log("PunchCube Velocity:" + payload.velocity.magnitude); // Current int currentWrist = side == Side.Left ? currentWristL : currentWristR; int currentBiceps = side == Side.Left ? currentBicepsL : currentBicepsR; // Width int widthWrist = side == Side.Left ? (int)Mathf.Lerp(widthWristL, maxWidthWristL, payload.velocity.magnitude): (int)Mathf.Lerp(widthWristR, maxWidthWristR, payload.velocity.magnitude); int widthBiceps = side == Side.Left ? (int)Mathf.Lerp(widthBicepsL, maxWidthBicepsL, payload.velocity.magnitude) : (int)Mathf.Lerp(widthBicepsR, maxWidthBicepsR, payload.velocity.magnitude); widthWrist = (int)Mathf.Lerp(0, widthWrist, payload.velocity.magnitude); stimInfo = new StimulationInfo[] { new StimulationInfo( Part.Wrist, side, widthWrist, currentWrist ), new StimulationInfo( Part.Biceps, side, widthBiceps, currentBiceps ), }; }
public override void InitParameters(string payloadString) { RepulsionPayload payload = JsonUtility.FromJson <RepulsionPayload>(payloadString); side = payload.side; // Current int currentWrist = side == Side.Left ? currentWristL : currentWristR; int currentBiceps = side == Side.Left ? currentBicepsL : currentBicepsR; // Width int widthWrist = side == Side.Left ? widthWristL : widthWristR; int widthBiceps = side == Side.Left ? widthBicepsL : widthBicepsR; stimInfo = new StimulationInfo[] { new StimulationInfo( Part.Wrist, side, widthWrist, currentWrist ), new StimulationInfo( Part.Biceps, side, widthBiceps, currentBiceps ), }; }
protected virtual void HandleWallCollision(Message msg) { VectorPayload payload = JsonUtility.FromJson <VectorPayload>(msg.payload); if (Mathf.Abs(payload.vector.z) < wallThreshold) { return; } // z-Axis looks to the left Side sideB = payload.vector.z > 0 ? Side.Left : Side.Right; Side sideT = payload.vector.z > 0 ? Side.Right : Side.Left; Debug.Log(payload.vector.z); StimulationInfo[] infos = new StimulationInfo[] { new StimulationInfo( Part.Triceps, sideT, wallImpactWidthTriceps, currentTriceps ), new StimulationInfo( Part.Biceps, sideB, wallImpactWidthBiceps, currentBiceps ), }; // Ramp up shortly ArmStimulation.StimulateArmBurst( infos, wallImpactDuration ); }