Inheritance: AnchoredJoint2D
Exemplo n.º 1
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D> ();
     anchor = spring.connectedBody.transform.position;
     rigidBody2D = GetComponent<Rigidbody2D> ();
     maxStretchSqr = MaxStretch * MaxStretch;
 }
Exemplo n.º 2
0
 void Awake()
 {
     myJoint = GetComponent<SpringJoint2D> ();
     myLine = GetComponent<LineRenderer> ();
     gamemaster = GameObject.FindGameObjectWithTag ("GAMEMASTER");
     canvasGo = GameObject.Find ("GUI");
 }
Exemplo n.º 3
0
	// Use this for initialization
	void Start () {
		trapBody = this.transform.GetComponent<Rigidbody2D> ();
		trapState = TrapState.Ready;
		spring = this.transform.GetComponent<SpringJoint2D> ();
		spring.distance = 0.25f;
		spring.enabled = true;
	}
Exemplo n.º 4
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D>();
     rigidbodyMF = GetComponent<Rigidbody2D>();
     catapult = spring.connectedAnchor*2+(Vector2)spring.connectedBody.position;
     maxStretchSqr = maxStretch * maxStretch;
 }
Exemplo n.º 5
0
    void Update()
    {
        if ( !Input.GetMouseButtonDown(0) ) {
            return;
        }

        Camera camera = FindCamera();
        RaycastHit2D hit = Physics2D.Raycast(
                camera.ScreenToWorldPoint(Input.mousePosition),
                Vector2.zero);

        if (hit.collider == null || !hit.rigidbody || hit.rigidbody.isKinematic) {
            return;
        }

        if (!springJoint) {
            GameObject obj = new GameObject("Rigidbody2D dragger");
            Rigidbody2D body = obj.AddComponent("Rigidbody2D") as Rigidbody2D;
            this.springJoint = obj.AddComponent("SpringJoint2D") as SpringJoint2D;
            body.isKinematic = true;
        }

        springJoint.transform.position = hit.point;

        springJoint.anchor = Vector2.zero;

        springJoint.connectedAnchor = hit.transform.InverseTransformPoint(hit.point);
        springJoint.dampingRatio = this.dampingRatio;
        springJoint.frequency = this.frequency;

        springJoint.collideConnected = false;
        springJoint.connectedBody = hit.rigidbody;

        StartCoroutine(DragObject());
    }
Exemplo n.º 6
0
 void Awake()
 {
     line = this.GetComponent<LineRenderer>();
     line.SetVertexCount(2);
     line.enabled = false;
     spring = this.GetComponent<SpringJoint2D>();
 }
 static public int get_distance(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.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.distance);
         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
 }
Exemplo n.º 8
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D>();
     rigid2d = GetComponent<Rigidbody2D>();
     collider2d = GetComponent<CircleCollider2D>();
     catapult = spring.connectedBody.transform;
 }
Exemplo n.º 9
0
 void Awake()
 {
     spring = this.gameObject.GetComponent<SpringJoint2D>();
     spring.connectedAnchor = gameObject.transform.position;
     spring.enabled = false;
     spring.distance = 0f;
 }
Exemplo n.º 10
0
 void Awake()
 {
     //line = this.GetComponent<lineRenderer>();
     //lineSetVertexCount(2);
     //lineenabled = false;
     spring = this.GetComponent<SpringJoint2D>();
 }
Exemplo n.º 11
0
    void Awake()
    {
        spring = this.gameObject.GetComponent<SpringJoint2D>();

        // initial anchor point based on starting position of game object
        spring.connectedAnchor = gameObject.transform.position;
    }
Exemplo n.º 12
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.SpringJoint2D o;
     o = new UnityEngine.SpringJoint2D();
     pushObject(l, o);
     return(1);
 }
Exemplo n.º 13
0
    private SpringJoint2D _spring; // The spring joint that will hold the projectile inside the specified radius

    #endregion Fields

    #region Methods

    /// <summary>
    /// Called when this object is active in the physics simulation
    /// </summary>
    void Awake()
    {
        // Get the catapult transform as soon as the physics simulation for this object starts
        _spring = GetComponent <SpringJoint2D> ();
        _catapult = _spring.connectedBody.transform;
        _sounds = GameObject.Find("LC").GetComponent<SoundAssets>();
    }
Exemplo n.º 14
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D>();
     rigid2d = GetComponent<Rigidbody2D>();
     prevVelocity = new Vector2();
     rayToMouse = new Ray(Vector3.zero, Vector3.zero);
 }
Exemplo n.º 15
0
    void Update()
    {  
 
            if (!Input.GetMouseButtonDown (0))
                    return;

            RaycastHit2D hit = Physics2D.Raycast(thisCamera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, selectableLayers);

            if (hit.collider != null && hit.collider.GetComponent<Rigidbody2D>() != null && hit.collider.GetComponent<Rigidbody2D>().isKinematic == false) 
            {
                if (!springJoint)
                {
                    GameObject go = new GameObject("Rigidbody2D Dragger");
                    go.hideFlags = HideFlags.HideAndDontSave;

                    Rigidbody2D body = go.AddComponent<Rigidbody2D>();
                    springJoint = go.AddComponent<SpringJoint2D>();               
                    body.isKinematic = true;
                } 
                springJoint.transform.position = hit.point;

                if (!attachToCenterOfMass)
                    hitOffset = hit.rigidbody.transform.InverseTransformPoint(hit.point);
                else
                    hitOffset = Vector2.zero;

                springJoint.distance = distance;
                springJoint.dampingRatio = damper;
                springJoint.connectedBody = hit.rigidbody;           

                StartCoroutine ("DragObject", hit.fraction);
            }
 
    }
Exemplo n.º 16
0
    void Start()
    {
        //	Calculate the Resset Speed Squared from the Reset Speed
        resetSpeedSqr = resetSpeed * resetSpeed;

        //	Get the SpringJoint2D component through our reference to the GameObject's Rigidbody
        spring = projectile.GetComponent <SpringJoint2D>();
    }
Exemplo n.º 17
0
	void Awake () {
		spring = GetComponent <SpringJoint2D> ();
		StartPos = this.transform.position;
		LevelManagerObj = GameObject.Find ("LevelManager");
		catapult = spring.connectedBody.transform;
		GetComponent<SpriteRenderer> ().sprite = PlayerSprite[PlayerPrefs.GetInt ("CurCharacterIndex")];
		GetComponent<CircleCollider2D> ().radius = 6;
	}
 void Awake()
 {
     if (GameController.Jeu.Tirs_Realises.Count >= GameController.Jeu.Config.Nb_lancers) {
         Application.LoadLevel("finDeTest");
     }
     spring = GetComponent <SpringJoint2D> ();
     catapult = spring.connectedBody.transform;
 }
Exemplo n.º 19
0
	public void Init(string _speciesName, char _speciesType, float _bodySize,
					 float _startPopulation, float _maxPopulation, float _minPopulation,
	                 GameObject _picture, Color border) {
		name = _speciesName;
		bodySize = _bodySize;
		maxPopulation = _maxPopulation;
		minPopulation = _minPopulation;
		speciesType = _speciesType;
		picture = Instantiate(_picture) as GameObject;
		picture.transform.parent = transform;
		picture.name = "picture";
		zoomState = ZoomState.zoom0;

		UpdatePopulation(_startPopulation);

		transferredAmounts = new Dictionary<string, float>();

		baseSpringZoom0 = gameObject.AddComponent<SpringJoint2D>();
		baseSpringZoom0.autoConfigureDistance = false;
		baseSpringZoom0.distance = 0.005f;
		baseSpringZoom0.dampingRatio = 0.7f;
		baseSpringZoom0.frequency = 0.8f;

		if (speciesType == 'p') {
			// TODO: change this arrangement from random to something similar that minion thing Physics.CheckSphere()
			baseSpringZoom0.connectedAnchor = new Vector2(Random.Range(-4f, 4f), -3f);
		} else {
			baseSpringZoom0.connectedAnchor = new Vector2(Random.Range(-4f, 4f), Mathf.Max(-1f, (Mathf.Log(bodySize)) - 1f));
		}
		transform.Find("border").gameObject.GetComponent<SpriteRenderer>().color = border;

		deathSpringZoom0 = gameObject.AddComponent<SpringJoint2D>();
		// TODO: implement the choice of dead animals
		deathSpringZoom0.connectedAnchor = new Vector2(7f, 0);
		deathSpringZoom0.autoConfigureDistance = false;
		deathSpringZoom0.distance = 0.005f;
		deathSpringZoom0.dampingRatio = 1f;
		deathSpringZoom0.frequency = 2f;
		deathSpringZoom0.enabled = false;

		interactionSpringsZoom0 = new List<SpringJoint2D>();

		baseSpringZoom1 = gameObject.AddComponent<SpringJoint2D>();
		baseSpringZoom1.autoConfigureDistance = false;
		baseSpringZoom1.distance = 0.005f;
		baseSpringZoom1.dampingRatio = 1f;
		baseSpringZoom1.frequency = 2f;
		baseSpringZoom1.enabled = false;

		if (population == 0) {
			alive = false;
			transform.position = deathSpringZoom0.connectedAnchor;
		} else {
			alive = true;
			transform.position = baseSpringZoom0.connectedAnchor;
		}
		SetZoom0();
	}
Exemplo n.º 20
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        tmpJointScene = gameObject.AddComponent<SpringJoint2D>();
        tmpBodyCursor = Instantiate(UtilityFunctions.Instance.cursorJointPrefab).GetComponent<Rigidbody2D>();

        tmpJointScene.connectedBody = tmpBodyCursor;
        tmpJointScene.distance = 0.01f;
        tmpJointScene.frequency = 0f;
    }
Exemplo n.º 21
0
	void Awake () {
		spring = GetComponent <SpringJoint2D> ();
		StartPos = this.transform.position;
		LevelManagerObj = GameObject.Find ("LevelManager");
		ScoreText = GameObject.Find ("ScoreText").GetComponent<Text>();
		catapult = spring.connectedBody.transform;
		GetComponent<SpriteRenderer> ().sprite = PlayerSprite[PlayerPrefs.GetInt ("CurCharacterIndex")];
		WallPoint = GameObject.Find ("LevelManager").GetComponent<LevelManager> ().WallPoint;
	}
Exemplo n.º 22
0
    static public int set_dampingRatio(IntPtr l)
    {
        UnityEngine.SpringJoint2D o = (UnityEngine.SpringJoint2D)checkSelf(l);
        float v;

        checkType(l, 2, out v);
        o.dampingRatio = v;
        return(0);
    }
Exemplo n.º 23
0
    static public int set_frequency(IntPtr l)
    {
        UnityEngine.SpringJoint2D o = (UnityEngine.SpringJoint2D)checkSelf(l);
        float v;

        checkType(l, 2, out v);
        o.frequency = v;
        return(0);
    }
Exemplo n.º 24
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D> ();
     catapult = spring.connectedBody.transform;
     if (current == null)
         current = this;
     else if(current != this)
         Destroy (gameObject);
 }
Exemplo n.º 25
0
	void Start(){
		transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,Input.mousePosition.y,10));
		spring = this.gameObject.GetComponent<SpringJoint2D>();
		spring.enabled = false;
		GetComponent<Rigidbody2D>().drag = dampening;
		spring.enabled = true;
		spring.connectedAnchor = Camera.main.ScreenToWorldPoint (Input.mousePosition);
		spring.anchor = transform.InverseTransformPoint (spring.connectedAnchor);

		}
Exemplo n.º 26
0
 // Use this for initialization
 public override void Start()
 {
     base.Start();
     dummySpring = GetComponent<SpringJoint2D>();
     hook = GetComponent<DistanceJoint2D>();
     if (soundEffectHandler == null)
     {
         soundEffectHandler = gameObject.GetComponent<SoundEffectHandler>();
     }
 }
 // Use this for initialization
 void Start()
 {
     //		GetComponentInChildren<LineRendererCode>().myPoint1 = transform.position;
     playerPos = parent.position;
     playerController = GetComponentInParent<PlayerController> ();
     lrc = GetComponentInChildren<LineRendererCode> ();
     lrc.enabled = false;
     lrc.myPoint1 = playerPos;
     rb2D = GetComponent<Rigidbody2D> ();
     sj2D = GetComponentInParent<SpringJoint2D> ();
 }
Exemplo n.º 28
0
	// Use this for initialization
	void Start () {
		if (joint == null) {
			joint = gameObject.AddComponent<SpringJoint2D>();
			joint.enabled=false;
		}
		if (dragAnchor == null) {
			dragAnchor = new GameObject ();
			anchorRB = dragAnchor.AddComponent<Rigidbody2D>();
			anchorRB.isKinematic=true;
		}
	}
Exemplo n.º 29
0
 static public int get_dampingRatio(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         pushValue(l, self.dampingRatio);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 30
0
	private bool movingTransform;		//is true when we are moving object which doesn't have rigidbody2D component


	void Start()
	{
		//create dragger object
		if(!dragger)
		{
			dragger = new GameObject("dragger");
			dragger.AddComponent<SpringJoint2D>();
		}

		//get springJoint2D component from dragger object
		springJoint = dragger.GetComponent<SpringJoint2D>();
	}
Exemplo n.º 31
0
 static public int get_dampingRatio(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.dampingRatio);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 32
0
 static public int get_autoConfigureDistance(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.autoConfigureDistance);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.SpringJoint2D o;
			o=new UnityEngine.SpringJoint2D();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
Exemplo n.º 34
0
    void Update()
    {
        if( Input.GetMouseButtonDown(0) ) {  // if andoid -> touch screen or andorid input ??? f**k
            // dmm f**k you
            Vector3 mouseWorldPos3D = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Vector2 mousePos2D = new Vector2(mouseWorldPos3D.x, mouseWorldPos3D.y);

            Vector2 dir = Vector2.zero;

            RaycastHit2D hit = Physics2D.Raycast(mousePos2D, dir);
            if(hit.collider!=null) {
                // gia tốc, quán tính for box
                if(hit.collider.GetComponent<Rigidbody2D>() != null) {
                    grabbedObject = hit.collider.GetComponent<Rigidbody2D>();

                    if(useSpring) {
                        springJoint = grabbedObject.gameObject.AddComponent<SpringJoint2D>();
                        // dặt các điểm neo mà mình click vô
                        Vector3 localHitPoint = grabbedObject.transform.InverseTransformPoint(hit.point);
                        springJoint.anchor = localHitPoint;
                        springJoint.connectedAnchor = mouseWorldPos3D;
                        springJoint.distance = 0.25f;
                        springJoint.dampingRatio = 1;
                        springJoint.frequency = 5;

                        springJoint.enableCollision = true;

                        springJoint.connectedBody = null;
                    }
                    else {
                        // dùng velocity
                        grabbedObject.gravityScale=0;
                    }

                    dragLine.enabled = true;
                }
            }
        }

        if( Input.GetMouseButtonUp(0) && grabbedObject!=null ) {
            //grabbedObject.gravityScale =1 ; // perty cool , trọng lực , if dont keep mouse -> box drop
            if(useSpring) {
                Destroy(springJoint);
                springJoint = null;
            }
            else {
                grabbedObject.gravityScale=1;
            }
            grabbedObject = null;
            dragLine.enabled = false;
        }
    }
Exemplo n.º 35
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D o;
         o = new UnityEngine.SpringJoint2D();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 36
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D o;
         o = new UnityEngine.SpringJoint2D();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D o;
         o=new UnityEngine.SpringJoint2D();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Exemplo n.º 38
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.SpringJoint2D o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.SpringJoint2D();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
Exemplo n.º 39
0
    void Update()
    {
        if( Input.GetMouseButtonDown(0) ) {

            Vector3 mouseWorldPos3D = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Vector2 mousePos2D = new Vector2(mouseWorldPos3D.x, mouseWorldPos3D.y);

            Vector2 dir = Vector2.zero;

            RaycastHit2D hit = Physics2D.Raycast(mousePos2D, dir);
            if(hit.collider!=null) {

                if(hit.collider.GetComponent<Rigidbody2D>() != null) {
                    grabbedObject = hit.collider.GetComponent<Rigidbody2D>();

                    if(useSpring) {
                        springJoint = grabbedObject.gameObject.AddComponent<SpringJoint2D>();

                        Vector3 localHitPoint = grabbedObject.transform.InverseTransformPoint(hit.point);
                        springJoint.anchor = localHitPoint;
                        springJoint.connectedAnchor = mouseWorldPos3D;
                        springJoint.distance = 0.25f;
                        springJoint.dampingRatio = 1;
                        springJoint.frequency = 5;

                        springJoint.enableCollision = true;

                        springJoint.connectedBody = null;
                    }
                    else {
                        // We're using velocity instead
                        grabbedObject.gravityScale=1;
                    }

                    dragLine.enabled = true;
                }
            }
        }

        if( Input.GetMouseButtonUp(0) && grabbedObject!=null ) {
            if(useSpring) {
                Destroy(springJoint);
                springJoint = null;
            }
            else {
                grabbedObject.gravityScale=1;
            }
            grabbedObject = null;
            dragLine.enabled = false;
        }
    }
Exemplo n.º 40
0
 static public int set_distance(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.distance = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 41
0
 static public int set_dampingRatio(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.dampingRatio = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 42
0
 static public int set_autoConfigureDistance(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.autoConfigureDistance = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 43
0
    public void Reset()
    {
        if(spring == null)
            spring = gameObject.AddComponent<SpringJoint2D>();

        spring.autoConfigureDistance = false;
        spring.distance = 1.0f;
        spring.frequency = 3.0f;
        spring.connectedBody = connectedBody;
        spring.enabled = true;

        catapultLineFront.enabled = true;
        catapultLineBack.enabled = true;
        LineRendererSetup();
    }
Exemplo n.º 44
0
 static public int GetReactionTorque(IntPtr l)
 {
     try{
         UnityEngine.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         System.Single             a1;
         checkType(l, 2, out a1);
         System.Single ret = self.GetReactionTorque(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static void SpringJoint2D_frequency(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.SpringJoint2D _this = (UnityEngine.SpringJoint2D)vc.csObj;
         var result = _this.frequency;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single             arg0  = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.SpringJoint2D _this = (UnityEngine.SpringJoint2D)vc.csObj;
         _this.frequency = arg0;
     }
 }
// fields

// properties
    static void SpringJoint2D_autoConfigureDistance(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.SpringJoint2D _this = (UnityEngine.SpringJoint2D)vc.csObj;
            var result = _this.autoConfigureDistance;
            JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
        }
        else
        {
            System.Boolean            arg0  = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
            UnityEngine.SpringJoint2D _this = (UnityEngine.SpringJoint2D)vc.csObj;
            _this.autoConfigureDistance = arg0;
        }
    }
 static public int GetReactionTorque(IntPtr l)
 {
     try {
         UnityEngine.SpringJoint2D self = (UnityEngine.SpringJoint2D)checkSelf(l);
         System.Single             a1;
         checkType(l, 2, out a1);
         var ret = self.GetReactionTorque(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 48
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.SpringJoint2D springJoint2D = (UnityEngine.SpringJoint2D)value;
     writer.WriteProperty("autoConfigureDistance", springJoint2D.autoConfigureDistance);
     writer.WriteProperty("distance", springJoint2D.distance);
     writer.WriteProperty("dampingRatio", springJoint2D.dampingRatio);
     writer.WriteProperty("frequency", springJoint2D.frequency);
     writer.WriteProperty("anchor", springJoint2D.anchor);
     writer.WriteProperty("connectedAnchor", springJoint2D.connectedAnchor);
     writer.WriteProperty("autoConfigureConnectedAnchor", springJoint2D.autoConfigureConnectedAnchor);
     writer.WriteProperty("connectedBody", springJoint2D.connectedBody);
     writer.WriteProperty("enableCollision", springJoint2D.enableCollision);
     writer.WriteProperty("breakForce", springJoint2D.breakForce);
     writer.WriteProperty("breakTorque", springJoint2D.breakTorque);
     writer.WriteProperty("enabled", springJoint2D.enabled);
     writer.WriteProperty("tag", springJoint2D.tag);
     writer.WriteProperty("name", springJoint2D.name);
     writer.WriteProperty("hideFlags", springJoint2D.hideFlags);
 }
Exemplo n.º 49
0
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.SpringJoint2D springJoint2D = SaveGameType.CreateComponent <UnityEngine.SpringJoint2D> ();
     ReadInto(springJoint2D, reader);
     return(springJoint2D);
 }
Exemplo n.º 50
0
 private static extern float INTERNAL_CALL_GetReactionTorque(SpringJoint2D self, float timeStep);
Exemplo n.º 51
0
 public float GetReactionTorque(float timeStep)
 {
     return(SpringJoint2D.INTERNAL_CALL_GetReactionTorque(this, timeStep));
 }
Exemplo n.º 52
0
 private static extern void SpringJoint2D_CUSTOM_INTERNAL_GetReactionForce(SpringJoint2D joint, float timeStep, out Vector2 value);
Exemplo n.º 53
0
 static public int get_frequency(IntPtr l)
 {
     UnityEngine.SpringJoint2D o = (UnityEngine.SpringJoint2D)checkSelf(l);
     pushValue(l, o.frequency);
     return(1);
 }
Exemplo n.º 54
0
 static public int get_dampingRatio(IntPtr l)
 {
     UnityEngine.SpringJoint2D o = (UnityEngine.SpringJoint2D)checkSelf(l);
     pushValue(l, o.dampingRatio);
     return(1);
 }
Exemplo n.º 55
0
 private static float INTERNAL_CALL_GetReactionTorque(SpringJoint2D self, float timeStep)
 {
     throw new NotImplementedException("なにこれ");
 }
Exemplo n.º 56
0
 private static void SpringJoint2D_CUSTOM_INTERNAL_GetReactionForce(SpringJoint2D joint, float timeStep, out Vector2 value)
 {
     throw new NotImplementedException("なにこれ");
 }
Exemplo n.º 57
0
 static public int get_distance(IntPtr l)
 {
     UnityEngine.SpringJoint2D o = (UnityEngine.SpringJoint2D)checkSelf(l);
     pushValue(l, o.distance);
     return(1);
 }
Exemplo n.º 58
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.SpringJoint2D springJoint2D = (UnityEngine.SpringJoint2D)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "autoConfigureDistance":
                    springJoint2D.autoConfigureDistance = reader.ReadProperty <System.Boolean> ();
                    break;

                case "distance":
                    springJoint2D.distance = reader.ReadProperty <System.Single> ();
                    break;

                case "dampingRatio":
                    springJoint2D.dampingRatio = reader.ReadProperty <System.Single> ();
                    break;

                case "frequency":
                    springJoint2D.frequency = reader.ReadProperty <System.Single> ();
                    break;

                case "anchor":
                    springJoint2D.anchor = reader.ReadProperty <UnityEngine.Vector2> ();
                    break;

                case "connectedAnchor":
                    springJoint2D.connectedAnchor = reader.ReadProperty <UnityEngine.Vector2> ();
                    break;

                case "autoConfigureConnectedAnchor":
                    springJoint2D.autoConfigureConnectedAnchor = reader.ReadProperty <System.Boolean> ();
                    break;

                case "connectedBody":
                    if (springJoint2D.connectedBody == null)
                    {
                        springJoint2D.connectedBody = reader.ReadProperty <UnityEngine.Rigidbody2D> ();
                    }
                    else
                    {
                        reader.ReadIntoProperty <UnityEngine.Rigidbody2D> (springJoint2D.connectedBody);
                    }
                    break;

                case "enableCollision":
                    springJoint2D.enableCollision = reader.ReadProperty <System.Boolean> ();
                    break;

                case "breakForce":
                    springJoint2D.breakForce = reader.ReadProperty <System.Single> ();
                    break;

                case "breakTorque":
                    springJoint2D.breakTorque = reader.ReadProperty <System.Single> ();
                    break;

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

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

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

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