A capsule-shaped primitive collider.

Inheritance: Collider2D
 static public int set_size(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.CapsuleCollider2D self = (UnityEngine.CapsuleCollider2D)checkSelf(l);
         UnityEngine.Vector2           v;
         checkType(l, 2, out v);
         self.size = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int get_direction(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.CapsuleCollider2D self = (UnityEngine.CapsuleCollider2D)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.direction);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int get_direction(IntPtr l)
 {
     try {
         UnityEngine.CapsuleCollider2D self = (UnityEngine.CapsuleCollider2D)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.direction);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_size(IntPtr l)
 {
     try {
         UnityEngine.CapsuleCollider2D self = (UnityEngine.CapsuleCollider2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.size);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.CapsuleCollider2D o;
         o = new UnityEngine.CapsuleCollider2D();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_direction(IntPtr l)
 {
     try {
         UnityEngine.CapsuleCollider2D  self = (UnityEngine.CapsuleCollider2D)checkSelf(l);
         UnityEngine.CapsuleDirection2D v;
         checkEnum(l, 2, out v);
         self.direction = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_size(IntPtr l)
 {
     try {
         UnityEngine.CapsuleCollider2D self = (UnityEngine.CapsuleCollider2D)checkSelf(l);
         UnityEngine.Vector2           v;
         checkType(l, 2, out v);
         self.size = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.CapsuleCollider2D capsuleCollider2D = (UnityEngine.CapsuleCollider2D)value;
     writer.WriteProperty("size", capsuleCollider2D.size);
     writer.WriteProperty("direction", capsuleCollider2D.direction);
     writer.WriteProperty("density", capsuleCollider2D.density);
     writer.WriteProperty("isTrigger", capsuleCollider2D.isTrigger);
     writer.WriteProperty("usedByEffector", capsuleCollider2D.usedByEffector);
     writer.WriteProperty("usedByComposite", capsuleCollider2D.usedByComposite);
     writer.WriteProperty("offset", capsuleCollider2D.offset);
     writer.WriteProperty("sharedMaterial", capsuleCollider2D.sharedMaterial);
     writer.WriteProperty("enabled", capsuleCollider2D.enabled);
     writer.WriteProperty("tag", capsuleCollider2D.tag);
     writer.WriteProperty("name", capsuleCollider2D.name);
     writer.WriteProperty("hideFlags", capsuleCollider2D.hideFlags);
 }
Ejemplo n.º 9
0
 public ColliderCapsule2D(UnityEngine.CapsuleCollider2D collider) : base(collider)
 {
     m_Collider = collider;
 }
        /// <summary>
        /// Read the data into the specified value.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="reader">Reader.</param>
        public override void ReadInto(object value, ISaveGameReader reader)
        {
            UnityEngine.CapsuleCollider2D capsuleCollider2D = (UnityEngine.CapsuleCollider2D)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "size":
                    capsuleCollider2D.size = reader.ReadProperty <UnityEngine.Vector2> ();
                    break;

                case "direction":
                    capsuleCollider2D.direction = reader.ReadProperty <UnityEngine.CapsuleDirection2D> ();
                    break;

                case "density":
                    capsuleCollider2D.density = reader.ReadProperty <System.Single> ();
                    break;

                case "isTrigger":
                    capsuleCollider2D.isTrigger = reader.ReadProperty <System.Boolean> ();
                    break;

                case "usedByEffector":
                    capsuleCollider2D.usedByEffector = reader.ReadProperty <System.Boolean> ();
                    break;

                case "usedByComposite":
                    capsuleCollider2D.usedByComposite = reader.ReadProperty <System.Boolean> ();
                    break;

                case "offset":
                    capsuleCollider2D.offset = reader.ReadProperty <UnityEngine.Vector2> ();
                    break;

                case "sharedMaterial":
                    if (capsuleCollider2D.sharedMaterial == null)
                    {
                        capsuleCollider2D.sharedMaterial = reader.ReadProperty <UnityEngine.PhysicsMaterial2D> ();
                    }
                    else
                    {
                        reader.ReadIntoProperty <UnityEngine.PhysicsMaterial2D> (capsuleCollider2D.sharedMaterial);
                    }
                    break;

                case "enabled":
                    capsuleCollider2D.enabled = reader.ReadProperty <System.Boolean> ();
                    break;

                case "tag":
                    capsuleCollider2D.tag = reader.ReadProperty <System.String> ();
                    break;

                case "name":
                    capsuleCollider2D.name = reader.ReadProperty <System.String> ();
                    break;

                case "hideFlags":
                    capsuleCollider2D.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> ();
                    break;
                }
            }
        }
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.CapsuleCollider2D capsuleCollider2D = SaveGameType.CreateComponent <UnityEngine.CapsuleCollider2D> ();
     ReadInto(capsuleCollider2D, reader);
     return(capsuleCollider2D);
 }