diff --git a/SHADE_CSharp/src/Events/CallbackAction.cs b/SHADE_CSharp/src/Events/CallbackAction.cs index 968302ed..623e4f59 100644 --- a/SHADE_CSharp/src/Events/CallbackAction.cs +++ b/SHADE_CSharp/src/Events/CallbackAction.cs @@ -61,8 +61,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[1]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -86,7 +103,7 @@ namespace SHADE /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -103,7 +120,7 @@ namespace SHADE { targetAction.Invoke(t1); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; _ = targetMethod.Invoke(TargetObject, parameters); @@ -138,8 +155,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[2]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -158,12 +192,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[2]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -180,7 +214,7 @@ namespace SHADE { targetAction.Invoke(t1, t2); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; @@ -216,8 +250,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[3]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -236,12 +287,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[3]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -258,7 +309,7 @@ namespace SHADE { targetAction.Invoke(t1, t2, t3); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; @@ -295,8 +346,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[4]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -315,12 +383,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[4]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -337,7 +405,7 @@ namespace SHADE { targetAction.Invoke(t1, t2, t3, t4); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; @@ -375,8 +443,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[5]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -395,12 +480,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[5]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -417,7 +502,7 @@ namespace SHADE { targetAction.Invoke(t1, t2, t3, t4, t5); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; @@ -456,8 +541,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[6]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -476,12 +578,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[6]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -498,7 +600,7 @@ namespace SHADE { targetAction.Invoke(t1, t2, t3, t4, t5, t6); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; @@ -538,8 +640,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[7]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -558,12 +677,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[7]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -580,7 +699,7 @@ namespace SHADE { targetAction.Invoke(t1, t2, t3, t4, t5, t6, t7); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; @@ -621,8 +740,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[8]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -641,12 +777,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[8]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -663,7 +799,7 @@ namespace SHADE { targetAction.Invoke(t1, t2, t3, t4, t5, t6, t7, t8); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; @@ -705,8 +841,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[9]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -725,12 +878,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[9]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -747,7 +900,7 @@ namespace SHADE { targetAction.Invoke(t1, t2, t3, t4, t5, t6, t7, t8, t9); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; @@ -790,8 +943,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[10]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -810,12 +980,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[10]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action action) { targetAction = action; @@ -832,7 +1002,7 @@ namespace SHADE { targetAction.Invoke(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { parameters[0] = t1; parameters[1] = t2; diff --git a/SHADE_CSharp/src/Events/CallbackAction.tt b/SHADE_CSharp/src/Events/CallbackAction.tt index fffd4251..34789b67 100644 --- a/SHADE_CSharp/src/Events/CallbackAction.tt +++ b/SHADE_CSharp/src/Events/CallbackAction.tt @@ -78,8 +78,25 @@ namespace SHADE /// public CallbackAction() {} /// - /// Constructs a CallbackAction that represents a call to the specified method on the - /// specified target. + /// Constructs a CallbackAction that represents a call to the specified static + /// method. + /// + /// Method to call. + /// + /// Thrown if a method that is not compatible with the target is specified. The method's + /// source type must match the target's type. + /// + public CallbackAction(MethodInfo method) + { + // No errors, assign + targetMethod = method; + + // Create storage for parameters for calling + parameters = new Object[<#=i#>]; + } + /// + /// Constructs a CallbackAction that represents a call to a specified member + /// method on the specified target. /// /// Object to call the method on. /// Method to call. @@ -98,12 +115,12 @@ namespace SHADE targetMethod = method; // Create storage for parameters for calling - parameters = new Object[1]; + parameters = new Object[<#=i#>]; } /// /// Constructs a Callback action based on an action. /// - /// + /// Action that wraps a function to be called. public CallbackAction(Action<<# for (int t = 1; t < i + 1; ++t) { #>T<#=t#><# if (t != i) { #>, <# } #><# } #>> action) { targetAction = action; @@ -120,7 +137,7 @@ namespace SHADE { targetAction.Invoke(<# for (int t = 1; t < i + 1; ++t) { #>t<#=t#><# if (t != i) { #>, <# } #><# } #>); } - else if (TargetObject != null && targetMethod != null) + else if (targetMethod != null) { <# for (int t = 0; t < i; ++t) {#>parameters[<#=t#>] = t<#=t+1#>; <# } #>_ = targetMethod.Invoke(TargetObject, parameters); diff --git a/SHADE_Managed/src/Components/Collider.hxx b/SHADE_Managed/src/Components/Collider.hxx index 1d1196f5..dc17ae7f 100644 --- a/SHADE_Managed/src/Components/Collider.hxx +++ b/SHADE_Managed/src/Components/Collider.hxx @@ -194,7 +194,7 @@ namespace SHADE /* Properties */ /*-----------------------------------------------------------------------------*/ /// - /// Total number of ColliderBounds in the Collider component. + /// Total number of ColliderShapes in the Collider component. /// property int CollisionShapeCount { diff --git a/TempScriptsFolder/PhysicsTest.cs b/TempScriptsFolder/PhysicsTest.cs index 6f9774c9..add5971d 100644 --- a/TempScriptsFolder/PhysicsTest.cs +++ b/TempScriptsFolder/PhysicsTest.cs @@ -28,7 +28,7 @@ public class PhysicsTest : Script Debug.LogError("Collider is NULL!"); } - var subColider = Collider.ColliderBoundsCount; + var subColider = Collider.CollisionShapeCount; Debug.Log($"There are {subColider} colliders."); } protected override void update()