Inheritance: AnchoredJoint2D
コード例 #1
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D> ();
     anchor = spring.connectedBody.transform.position;
     rigidBody2D = GetComponent<Rigidbody2D> ();
     maxStretchSqr = MaxStretch * MaxStretch;
 }
コード例 #2
0
ファイル: flail.cs プロジェクト: Baserfaz/flailgame
 void Awake()
 {
     myJoint = GetComponent<SpringJoint2D> ();
     myLine = GetComponent<LineRenderer> ();
     gamemaster = GameObject.FindGameObjectWithTag ("GAMEMASTER");
     canvasGo = GameObject.Find ("GUI");
 }
コード例 #3
0
ファイル: TrapManager.cs プロジェクト: tediris/CS194GameDev
	// 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;
	}
コード例 #4
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D>();
     rigidbodyMF = GetComponent<Rigidbody2D>();
     catapult = spring.connectedAnchor*2+(Vector2)spring.connectedBody.position;
     maxStretchSqr = maxStretch * maxStretch;
 }
コード例 #5
0
ファイル: dragThrow.cs プロジェクト: tjsnyd/Unity-Projects
    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());
    }
コード例 #6
0
 void Awake()
 {
     line = this.GetComponent<LineRenderer>();
     line.SetVertexCount(2);
     line.enabled = false;
     spring = this.GetComponent<SpringJoint2D>();
 }
コード例 #7
0
 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
 }
コード例 #8
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D>();
     rigid2d = GetComponent<Rigidbody2D>();
     collider2d = GetComponent<CircleCollider2D>();
     catapult = spring.connectedBody.transform;
 }
コード例 #9
0
ファイル: TempDrag.cs プロジェクト: mikkelworld/ZombieClicker
 void Awake()
 {
     spring = this.gameObject.GetComponent<SpringJoint2D>();
     spring.connectedAnchor = gameObject.transform.position;
     spring.enabled = false;
     spring.distance = 0f;
 }
コード例 #10
0
ファイル: HookRope.cs プロジェクト: DeeCeptor/PerilousClimb
 void Awake()
 {
     //line = this.GetComponent<lineRenderer>();
     //lineSetVertexCount(2);
     //lineenabled = false;
     spring = this.GetComponent<SpringJoint2D>();
 }
コード例 #11
0
ファイル: DragScript.cs プロジェクト: Shmiddy/Alone
    void Awake()
    {
        spring = this.gameObject.GetComponent<SpringJoint2D>();

        // initial anchor point based on starting position of game object
        spring.connectedAnchor = gameObject.transform.position;
    }
コード例 #12
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.SpringJoint2D o;
     o = new UnityEngine.SpringJoint2D();
     pushObject(l, o);
     return(1);
 }
コード例 #13
0
ファイル: ProjectileDragging.cs プロジェクト: Trebble57/Kacke
    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>();
    }
コード例 #14
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D>();
     rigid2d = GetComponent<Rigidbody2D>();
     prevVelocity = new Vector2();
     rayToMouse = new Ray(Vector3.zero, Vector3.zero);
 }
コード例 #15
0
ファイル: Draggable2D.cs プロジェクト: tmkebr/Untitled
    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);
            }
 
    }
コード例 #16
0
ファイル: Resetter.cs プロジェクト: nguyenqphan/AngryBirds
    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>();
    }
コード例 #17
0
ファイル: BluePlayer.cs プロジェクト: joaofxp/Reflect-2.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;
	}
コード例 #18
0
 void Awake()
 {
     if (GameController.Jeu.Tirs_Realises.Count >= GameController.Jeu.Config.Nb_lancers) {
         Application.LoadLevel("finDeTest");
     }
     spring = GetComponent <SpringJoint2D> ();
     catapult = spring.connectedBody.transform;
 }
コード例 #19
0
ファイル: SpeciesIcon.cs プロジェクト: jxz12/ecosystems_game
	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();
	}
コード例 #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;
    }
コード例 #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;
	}
コード例 #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);
    }
コード例 #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);
    }
コード例 #24
0
 void Awake()
 {
     spring = GetComponent<SpringJoint2D> ();
     catapult = spring.connectedBody.transform;
     if (current == null)
         current = this;
     else if(current != this)
         Destroy (gameObject);
 }
コード例 #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);

		}
コード例 #26
0
ファイル: GrappleHook.cs プロジェクト: ironpencil/critomit
 // Use this for initialization
 public override void Start()
 {
     base.Start();
     dummySpring = GetComponent<SpringJoint2D>();
     hook = GetComponent<DistanceJoint2D>();
     if (soundEffectHandler == null)
     {
         soundEffectHandler = gameObject.GetComponent<SoundEffectHandler>();
     }
 }
コード例 #27
0
 // 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> ();
 }
コード例 #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;
		}
	}
コード例 #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);
     }
 }
コード例 #30
0
ファイル: Drag.cs プロジェクト: diglungdig/AquaSkiing
	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>();
	}
コード例 #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));
     }
 }
コード例 #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));
     }
 }
コード例 #33
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);
		}
	}
コード例 #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;
        }
    }
コード例 #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));
     }
 }
コード例 #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);
     }
 }
コード例 #37
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;
     }
 }
コード例 #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);
 }
コード例 #39
0
ファイル: MouseManager.cs プロジェクト: Rebedalm16/stackhigh
    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;
        }
    }
コード例 #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);
     }
 }
コード例 #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));
     }
 }
コード例 #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));
     }
 }
コード例 #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();
    }
コード例 #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);
     }
 }
コード例 #45
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;
     }
 }
コード例 #46
0
// 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;
        }
    }
コード例 #47
0
 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));
     }
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #50
0
 private static extern float INTERNAL_CALL_GetReactionTorque(SpringJoint2D self, float timeStep);
コード例 #51
0
 public float GetReactionTorque(float timeStep)
 {
     return(SpringJoint2D.INTERNAL_CALL_GetReactionTorque(this, timeStep));
 }
コード例 #52
0
 private static extern void SpringJoint2D_CUSTOM_INTERNAL_GetReactionForce(SpringJoint2D joint, float timeStep, out Vector2 value);
コード例 #53
0
 static public int get_frequency(IntPtr l)
 {
     UnityEngine.SpringJoint2D o = (UnityEngine.SpringJoint2D)checkSelf(l);
     pushValue(l, o.frequency);
     return(1);
 }
コード例 #54
0
 static public int get_dampingRatio(IntPtr l)
 {
     UnityEngine.SpringJoint2D o = (UnityEngine.SpringJoint2D)checkSelf(l);
     pushValue(l, o.dampingRatio);
     return(1);
 }
コード例 #55
0
 private static float INTERNAL_CALL_GetReactionTorque(SpringJoint2D self, float timeStep)
 {
     throw new NotImplementedException("なにこれ");
 }
コード例 #56
0
 private static void SpringJoint2D_CUSTOM_INTERNAL_GetReactionForce(SpringJoint2D joint, float timeStep, out Vector2 value)
 {
     throw new NotImplementedException("なにこれ");
 }
コード例 #57
0
 static public int get_distance(IntPtr l)
 {
     UnityEngine.SpringJoint2D o = (UnityEngine.SpringJoint2D)checkSelf(l);
     pushValue(l, o.distance);
     return(1);
 }
コード例 #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;
                }
            }
        }