40 lines
622 B
C#
40 lines
622 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class Rope : MonoBehaviour {
|
|
public HingeJoint2D[] objects;
|
|
bool isfixed = false;
|
|
int fixCount = 0;
|
|
// Use this for initialization
|
|
void Start () {
|
|
//Invoke("Fix", Time.time);
|
|
//
|
|
}
|
|
|
|
void Fix(){
|
|
|
|
foreach(var j in objects){
|
|
j.useMotor = true;
|
|
JointMotor2D m = new JointMotor2D();
|
|
m.maxMotorTorque = 0;
|
|
m.motorSpeed = 0;
|
|
j.motor = m;
|
|
j.useMotor = false;
|
|
j.enabled = true;
|
|
}
|
|
}
|
|
|
|
void FixedUpdate(){
|
|
if(fixCount < 10){
|
|
Fix();
|
|
isfixed = true;
|
|
fixCount++;
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
|
|
}
|
|
}
|