Parent class for joints to connect Rigidbody2D objects.

Inheritance: Behaviour
Exemple #1
0
        public Vector2 GetReactionForce(float timeStep)
        {
            Vector2 result;

            Joint2D.Internal_GetReactionForce(this, timeStep, out result);
            return(result);
        }
Exemple #2
0
    static void Joint2D_reactionTorque(JSVCall vc)
    {
        UnityEngine.Joint2D _this = (UnityEngine.Joint2D)vc.csObj;
        var result = _this.reactionTorque;

        JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
    }
Exemple #3
0
        public Vector2 GetReactionForce(float timeStep)
        {
            Vector2 result;

            Joint2D.Joint2D_CUSTOM_INTERNAL_GetReactionForce(this, timeStep, out result);
            return(result);
        }
Exemple #4
0
        /// <summary>
        ///   <para>Gets the reaction force of the joint given the specified timeStep.</para>
        /// </summary>
        /// <param name="timeStep">The time to calculate the reaction force for.</param>
        /// <returns>
        ///   <para>The reaction force of the joint in the specified timeStep.</para>
        /// </returns>
        public Vector2 GetReactionForce(float timeStep)
        {
            Vector2 vector2;

            Joint2D.Joint2D_CUSTOM_INTERNAL_GetReactionForce(this, timeStep, out vector2);
            return(vector2);
        }
Exemple #5
0
 static public int GetReactionForce(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.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         System.Single       a1;
         checkType(l, 2, out a1);
         var ret = self.GetReactionForce(a1);
         pushValue(l, true);
         pushValue(l, ret);
         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
 }
Exemple #6
0
 static public int get_attachedRigidbody(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.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.attachedRigidbody);
         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
 }
Exemple #7
0
 static public int set_breakTorque(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.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.breakTorque = 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
 }
 public void UpdateJoint(Joint2D joint)
 {
     initialized = true;
     if (!attachedJoints.Contains(joint)) {
         attachedJoints.Add(joint);
     }
 }
Exemple #9
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.Joint2D o;
     o = new UnityEngine.Joint2D();
     pushObject(l, o);
     return(1);
 }
Exemple #10
0
    static void Joint2D_reactionForce(JSVCall vc)
    {
        UnityEngine.Joint2D _this = (UnityEngine.Joint2D)vc.csObj;
        var result = _this.reactionForce;

        JSApi.setVector2S((int)JSApi.SetType.Rval, result);
    }
Exemple #11
0
 static public int set_connectedBody(IntPtr l)
 {
     UnityEngine.Joint2D     o = (UnityEngine.Joint2D)checkSelf(l);
     UnityEngine.Rigidbody2D v;
     checkType(l, 2, out v);
     o.connectedBody = v;
     return(0);
 }
Exemple #12
0
    static public int set_collideConnected(IntPtr l)
    {
        UnityEngine.Joint2D o = (UnityEngine.Joint2D)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.collideConnected = v;
        return(0);
    }
 static public int get_connectedBody(IntPtr l)
 {
     try {
         UnityEngine.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.connectedBody);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_enableCollision(IntPtr l)
 {
     try {
         UnityEngine.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.enableCollision);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_reactionTorque(IntPtr l)
 {
     try {
         UnityEngine.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.reactionTorque);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #16
0
 static public int get_collideConnected(IntPtr l)
 {
     try {
         UnityEngine.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         pushValue(l, self.collideConnected);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.Joint2D o;
			o=new UnityEngine.Joint2D();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
Exemple #18
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.Joint2D o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.Joint2D();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
Exemple #19
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Joint2D o;
         o = new UnityEngine.Joint2D();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #20
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Joint2D o;
         o = new UnityEngine.Joint2D();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go != null)
            {
                _joint2d = go.GetComponent<Joint2D>();
            }

            SetProperty();

            Finish();
        }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.Joint2D o;
         o=new UnityEngine.Joint2D();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
 static public int set_connectedBody(IntPtr l)
 {
     try {
         UnityEngine.Joint2D     self = (UnityEngine.Joint2D)checkSelf(l);
         UnityEngine.Rigidbody2D v;
         checkType(l, 2, out v);
         self.connectedBody = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_breakTorque(IntPtr l)
 {
     try {
         UnityEngine.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.breakTorque = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #25
0
 static public int set_collideConnected(IntPtr l)
 {
     try {
         UnityEngine.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.collideConnected = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int set_enableCollision(IntPtr l)
 {
     try {
         UnityEngine.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.enableCollision = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #27
0
 static public int set_connectedBody(IntPtr l)
 {
     try {
         UnityEngine.Joint2D     self = (UnityEngine.Joint2D)checkSelf(l);
         UnityEngine.Rigidbody2D v;
         checkType(l, 2, out v);
         self.connectedBody = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemple #28
0
 static void Joint2D_breakTorque(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.Joint2D _this = (UnityEngine.Joint2D)vc.csObj;
         var result = _this.breakTorque;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single       arg0  = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.Joint2D _this = (UnityEngine.Joint2D)vc.csObj;
         _this.breakTorque = arg0;
     }
 }
Exemple #29
0
 static void Joint2D_enableCollision(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.Joint2D _this = (UnityEngine.Joint2D)vc.csObj;
         var result = _this.enableCollision;
         JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
     }
     else
     {
         System.Boolean      arg0  = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
         UnityEngine.Joint2D _this = (UnityEngine.Joint2D)vc.csObj;
         _this.enableCollision = arg0;
     }
 }
Exemple #30
0
// fields

// properties
    static void Joint2D_connectedBody(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.Joint2D _this = (UnityEngine.Joint2D)vc.csObj;
            var result = _this.connectedBody;
            JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
        }
        else
        {
            UnityEngine.Rigidbody2D arg0  = (UnityEngine.Rigidbody2D)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            UnityEngine.Joint2D     _this = (UnityEngine.Joint2D)vc.csObj;
            _this.connectedBody = arg0;
        }
    }
 static public int GetReactionForce(IntPtr l)
 {
     try {
         UnityEngine.Joint2D self = (UnityEngine.Joint2D)checkSelf(l);
         System.Single       a1;
         checkType(l, 2, out a1);
         var ret = self.GetReactionForce(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 private static extern float INTERNAL_CALL_GetReactionTorque(Joint2D self, float timeStep);
 private static extern void Joint2D_CUSTOM_INTERNAL_GetReactionForce(Joint2D joint, float timeStep, out Vector2 value);
 IEnumeratorOrVoid OnJointBreak2D(Joint2D joint)
 {
     return(null);
 }
    public override void Setup(Joint2D joint2D)
    {
        base.Setup(joint2D);

        anchorPriority = AnchorPriority.Main;
    }
Exemple #36
0
 private static extern float INTERNAL_CALL_GetReactionTorque(Joint2D self, float timeStep);
 public virtual void Setup(Joint2D joint2D)
 {
     setupComplete = true;
     attachedJoint = joint2D;
 }
Exemple #38
0
 private static extern void Joint2D_CUSTOM_INTERNAL_GetReactionForce(Joint2D joint, float timeStep, out Vector2 value);
Exemple #39
0
        void MarkForPickup(GameObject headObject, Joint2D[] joints, GameObject[] playerParts)
        {
            Hashtable table = new Hashtable ();
            table.Add (headObject.GetInstanceID (), headObject);

            if (joints != null) {
                foreach (Joint2D joint in joints) {

                    if (joint != null && joint.connectedBody != null && joint.connectedBody.gameObject != null) {
                        GameObject obj = joint.connectedBody.gameObject;
                        if (!table.ContainsKey (obj.GetInstanceID ())) {
                            table.Add (obj.GetInstanceID (), obj);
                            ProcessConnectedObjects (obj, table);
                        }
                    } else {
                        DestroyImmediate (joint);
                    }
                }
            }

            if (table.Count < playerParts.Length + 1) {
                foreach (GameObject part in playerParts) {
                    if (part.tag.Equals (Constants.TAG_CURRENT_PLAYER))
                        continue;

                    if (!table.ContainsKey (part.GetInstanceID ())) {
                        MarkForPickup (part);
                    }
                }
            }
        }
Exemple #40
0
    private void LooseJoint(Joint2D joint)
    {
        GameManager gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();

        if (joint.gameObject.name.Equals("Head") || joint.gameObject.name.Equals("Body"))
        {
            gm.SetWin(transform.parent.gameObject);
            gm.confettis.SetActive(true);
        }

        if (joint.GetComponent<CandiesEmitter>() != null)
            joint.GetComponent<CandiesEmitter>().EmitCandies();

        Destroy(joint);

		// Tilt camera
		Camera.main.GetComponent<CameraManager>().TiltCamera(0.25f);
    }