Applies "platform" behaviour such as one-way collisions etc.

Inheritance: Effector2D
 static public int get_useOneWayGrouping(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.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.useOneWayGrouping);
         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
 }
 private static void DrawSideArc(PlatformEffector2D effector)
 {
   Vector3 vector3_1 = effector.transform.TransformVector(Vector3.up);
   float f = (float) (Math.PI / 180.0 * (double) effector.sideArc * 0.5) - Mathf.Atan2(vector3_1.x, vector3_1.y);
   float angle = Mathf.Clamp(effector.sideArc, 0.5f, 180f);
   float num = angle * ((float) Math.PI / 180f);
   foreach (Collider2D collider2D in ((IEnumerable<Collider2D>) effector.gameObject.GetComponents<Collider2D>()).Where<Collider2D>((Func<Collider2D, bool>) (collider =>
   {
     if (collider.enabled)
       return collider.usedByEffector;
     return false;
   })))
   {
     Vector3 center = collider2D.bounds.center;
     float radius = HandleUtility.GetHandleSize(center) * 0.8f;
     Vector3 from1 = new Vector3(-Mathf.Cos(f), -Mathf.Sin(f), 0.0f);
     Vector3 vector3_2 = new Vector3(-Mathf.Cos(f - num), -Mathf.Sin(f - num), 0.0f);
     Vector3 from2 = new Vector3(Mathf.Cos(f), Mathf.Sin(f), 0.0f);
     Vector3 vector3_3 = new Vector3(Mathf.Cos(f - num), Mathf.Sin(f - num), 0.0f);
     Handles.color = new Color(0.0f, 1f, 0.7f, 0.03f);
     Handles.DrawSolidArc(center, Vector3.back, from1, angle, radius);
     Handles.DrawSolidArc(center, Vector3.back, from2, angle, radius);
     Handles.color = new Color(0.0f, 1f, 0.7f, 0.7f);
     Handles.DrawWireArc(center, Vector3.back, from1, angle, radius);
     Handles.DrawWireArc(center, Vector3.back, from2, angle, radius);
     Handles.DrawDottedLine(center + from1 * radius, center + from2 * radius, 5f);
     Handles.DrawDottedLine(center + vector3_2 * radius, center + vector3_3 * radius, 5f);
   }
 }
 static public int set_rotationalOffset(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.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.rotationalOffset = 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
 }
Beispiel #4
0
 static public int get_useSideBounce(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         pushValue(l, self.useSideBounce);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int get_useOneWayGrouping(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.useOneWayGrouping);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #6
0
 static public int get_sideBounce(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.sideBounce);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.PlatformEffector2D o;
			o=new UnityEngine.PlatformEffector2D();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
Beispiel #8
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D o;
         o = new UnityEngine.PlatformEffector2D();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D o;
         o=new UnityEngine.PlatformEffector2D();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Beispiel #10
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D o;
         o = new UnityEngine.PlatformEffector2D();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #11
0
 static public int set_useSideBounce(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.useSideBounce = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Beispiel #12
0
 static public int set_sideAngleVariance(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.sideAngleVariance = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Beispiel #13
0
 static public int set_sideBounce(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.sideBounce = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_rotationalOffset(IntPtr l)
 {
     try {
         UnityEngine.PlatformEffector2D self = (UnityEngine.PlatformEffector2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.rotationalOffset = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static void PlatformEffector2D_useSideBounce(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.PlatformEffector2D _this = (UnityEngine.PlatformEffector2D)vc.csObj;
         var result = _this.useSideBounce;
         JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
     }
     else
     {
         System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
         UnityEngine.PlatformEffector2D _this = (UnityEngine.PlatformEffector2D)vc.csObj;
         _this.useSideBounce = arg0;
     }
 }
 static void PlatformEffector2D_sideArc(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.PlatformEffector2D _this = (UnityEngine.PlatformEffector2D)vc.csObj;
         var result = _this.sideArc;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.PlatformEffector2D _this = (UnityEngine.PlatformEffector2D)vc.csObj;
         _this.sideArc = arg0;
     }
 }
 private static void DrawSideArc(PlatformEffector2D effector)
 {
     float f = -0.01745329f * (90f + effector.rotationalOffset);
     Vector3 normalized = effector.transform.TransformVector(new Vector3(Mathf.Sin(f), Mathf.Cos(f), 0f)).normalized;
     if (normalized.sqrMagnitude >= Mathf.Epsilon)
     {
         float num2 = Mathf.Atan2(normalized.x, normalized.y);
         float num3 = num2 + 3.141593f;
         float angle = Mathf.Clamp(effector.sideArc, 0.5f, 180f);
         float num5 = (angle * 0.5f) * 0.01745329f;
         Vector3 from = new Vector3(Mathf.Sin(num2 - num5), Mathf.Cos(num2 - num5), 0f);
         Vector3 vector4 = new Vector3(Mathf.Sin(num2 + num5), Mathf.Cos(num2 + num5), 0f);
         Vector3 vector5 = new Vector3(Mathf.Sin(num3 - num5), Mathf.Cos(num3 - num5), 0f);
         Vector3 vector6 = new Vector3(Mathf.Sin(num3 + num5), Mathf.Cos(num3 + num5), 0f);
         if (<>f__am$cache1 == null)
         {
Beispiel #18
0
 /// <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.PlatformEffector2D platformEffector2D = (UnityEngine.PlatformEffector2D)value;
     writer.WriteProperty("useOneWay", platformEffector2D.useOneWay);
     writer.WriteProperty("useOneWayGrouping", platformEffector2D.useOneWayGrouping);
     writer.WriteProperty("useSideFriction", platformEffector2D.useSideFriction);
     writer.WriteProperty("useSideBounce", platformEffector2D.useSideBounce);
     writer.WriteProperty("surfaceArc", platformEffector2D.surfaceArc);
     writer.WriteProperty("sideArc", platformEffector2D.sideArc);
     writer.WriteProperty("rotationalOffset", platformEffector2D.rotationalOffset);
     writer.WriteProperty("useColliderMask", platformEffector2D.useColliderMask);
     writer.WriteProperty("colliderMask", platformEffector2D.colliderMask);
     writer.WriteProperty("enabled", platformEffector2D.enabled);
     writer.WriteProperty("tag", platformEffector2D.tag);
     writer.WriteProperty("name", platformEffector2D.name);
     writer.WriteProperty("hideFlags", platformEffector2D.hideFlags);
 }
    static int _CreatePlatformEffector2D(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            PlatformEffector2D obj = new PlatformEffector2D();
            LuaScriptMgr.Push(L, obj);
            return 1;
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: PlatformEffector2D.New");
        }

        return 0;
    }
Beispiel #20
0
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.PlatformEffector2D platformEffector2D = SaveGameType.CreateComponent <UnityEngine.PlatformEffector2D> ();
     ReadInto(platformEffector2D, reader);
     return(platformEffector2D);
 }
Beispiel #21
0
        /// <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.PlatformEffector2D platformEffector2D = (UnityEngine.PlatformEffector2D)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "useOneWay":
                    platformEffector2D.useOneWay = reader.ReadProperty <System.Boolean> ();
                    break;

                case "useOneWayGrouping":
                    platformEffector2D.useOneWayGrouping = reader.ReadProperty <System.Boolean> ();
                    break;

                case "useSideFriction":
                    platformEffector2D.useSideFriction = reader.ReadProperty <System.Boolean> ();
                    break;

                case "useSideBounce":
                    platformEffector2D.useSideBounce = reader.ReadProperty <System.Boolean> ();
                    break;

                case "surfaceArc":
                    platformEffector2D.surfaceArc = reader.ReadProperty <System.Single> ();
                    break;

                case "sideArc":
                    platformEffector2D.sideArc = reader.ReadProperty <System.Single> ();
                    break;

                case "rotationalOffset":
                    platformEffector2D.rotationalOffset = reader.ReadProperty <System.Single> ();
                    break;

                case "useColliderMask":
                    platformEffector2D.useColliderMask = reader.ReadProperty <System.Boolean> ();
                    break;

                case "colliderMask":
                    platformEffector2D.colliderMask = reader.ReadProperty <System.Int32> ();
                    break;

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

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

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

                case "hideFlags":
                    platformEffector2D.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> ();
                    break;
                }
            }
        }