A game about forced loneliness, made by TACStudios
1using System; 2using UnityEngine; 3 4namespace Unity.VisualScripting 5{ 6#if MODULE_PHYSICS_2D_EXISTS 7 /// <summary> 8 /// Called when a joint attached to the same game object broke. 9 /// </summary> 10 [UnitCategory("Events/Physics 2D")] 11 public sealed class OnJointBreak2D : GameObjectEventUnit<Joint2D> 12 { 13 public override Type MessageListenerType => typeof(UnityOnJointBreak2DMessageListener); 14 15 protected override string hookName => EventHooks.OnJointBreak2D; 16 17 /// <summary> 18 /// The force that needs to be applied for the joint that broke to break. 19 /// </summary> 20 [DoNotSerialize] 21 public ValueOutput breakForce { get; private set; } 22 23 /// <summary> 24 /// The torque that needs to be applied for the joint that broke to break. 25 /// </summary> 26 [DoNotSerialize] 27 public ValueOutput breakTorque { get; private set; } 28 29 /// <summary> 30 /// The 2D rigidbody to which the other end of the joint is attached (ie, the object without the joint component). 31 /// </summary> 32 [DoNotSerialize] 33 public ValueOutput connectedBody { get; private set; } 34 35 /// <summary> 36 /// The reaction force of the joint that broke. 37 /// </summary> 38 [DoNotSerialize] 39 public ValueOutput reactionForce { get; private set; } 40 41 /// <summary> 42 /// The reaction torque of the joint that broke. 43 /// </summary> 44 [DoNotSerialize] 45 public ValueOutput reactionTorque { get; private set; } 46 47 /// <summary> 48 /// The joint that broke. 49 /// </summary> 50 [DoNotSerialize] 51 public ValueOutput joint { get; private set; } 52 53 protected override void Definition() 54 { 55 base.Definition(); 56 57 breakForce = ValueOutput<float>(nameof(breakForce)); 58 breakTorque = ValueOutput<float>(nameof(breakTorque)); 59 connectedBody = ValueOutput<Rigidbody2D>(nameof(connectedBody)); 60 reactionForce = ValueOutput<Vector2>(nameof(reactionForce)); 61 reactionTorque = ValueOutput<float>(nameof(reactionTorque)); 62 joint = ValueOutput<Joint2D>(nameof(joint)); 63 } 64 65 protected override void AssignArguments(Flow flow, Joint2D joint) 66 { 67 flow.SetValue(breakForce, joint.breakForce); 68 flow.SetValue(breakTorque, joint.breakTorque); 69 flow.SetValue(connectedBody, joint.connectedBody); 70 flow.SetValue(reactionForce, joint.reactionForce); 71 flow.SetValue(reactionTorque, joint.reactionTorque); 72 flow.SetValue(this.joint, joint); 73 } 74 } 75#endif 76}