aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bindings/cs/libsurvive.net/LibSurViveAPI.cs40
1 files changed, 29 insertions, 11 deletions
diff --git a/bindings/cs/libsurvive.net/LibSurViveAPI.cs b/bindings/cs/libsurvive.net/LibSurViveAPI.cs
index aa2fdae..922a055 100644
--- a/bindings/cs/libsurvive.net/LibSurViveAPI.cs
+++ b/bindings/cs/libsurvive.net/LibSurViveAPI.cs
@@ -309,24 +309,42 @@ public class LibSurViveAPI
public class SurviveObject
{
- public SurvivePose pose { get; private set; }
+ private SurvivePose _pose;
+ public SurvivePose Pose
+ {
+ get
+ {
+ var ptr1 = cfunctions.Survive_object_pose(ptr);
+ return (SurvivePose)Marshal.PtrToStructure(ptr1, typeof(SurvivePose));
+ }
+ }
- public int charge { get; private set; }
- public bool charging { get; private set; }
+ private int _charge;
+ public int Charge
+ {
+ get
+ {
+ return cfunctions.Survive_object_charge(ptr);
+ }
+ }
+ public bool Charging
+ {
+ get
+ {
+ return cfunctions.Survive_object_charging(ptr);
+ }
+ }
+ IntPtr ptr;
+ private bool _charging;
- public SurviveObject(IntPtr ptr)
+ public SurviveObject(IntPtr obj_ptr)
{
- if (ptr == IntPtr.Zero)
+ if (obj_ptr == IntPtr.Zero)
{
throw new Exception("Can't create SurviveObject with 0 pointer");
}
- var ptr1 = cfunctions.Survive_object_pose(ptr);
- pose = (SurvivePose)Marshal.PtrToStructure(ptr1, typeof(SurvivePose));
-
- //pose =
- charge = cfunctions.Survive_object_charge(ptr);
- charging = cfunctions.Survive_object_charging(ptr);
+ ptr = obj_ptr;
}
}