Пример #1
0
 IEnumerator dostuff()
 {
     while (on)
     {
         nowtime += Time.deltaTime;
         if (nowtime >= StopTime)
         {
             foreach (LPParticleSpawner spawner in Spawners)
             {
                 spawner.StopSpawning();
             }
         }
         if (nowtime >= StartTime)
         {
             LPAPIJoint.SetRevoluteJointMotorSpeed(joint.GetPtr(), 15f);
             on = false;
         }
         yield return(null);
     }
 }
Пример #2
0
    protected override void Initialise2(IntPtr world)
    {
        Vector3 anchorA = transform.position - BodyA.transform.position;
        Vector3 anchorB = transform.position - BodyB.transform.position;

        ThingPtr = LPAPIJoint.CreateRevoluteJoint(world, BodyA.GetComponent <LPBody>().GetPtr(), BodyB.GetComponent <LPBody>().GetPtr()
                                                  , anchorA.x, anchorA.y, anchorB.x, anchorB.y, CollideConnected);
        if (HasMotor)
        {
            LPAPIJoint.EnableRevoluteJointMotor(ThingPtr, HasMotor);
            LPAPIJoint.SetRevoluteJointMaxMotorTorque(ThingPtr, MaxMotorTorque);
            LPAPIJoint.SetRevoluteJointMotorSpeed(ThingPtr, MotorSpeed);
        }

        if (HasLimits)
        {
            LPAPIJoint.EnableRevoluteJointLimits(ThingPtr, HasLimits);
            LPAPIJoint.SetRevoluteJointLimits(ThingPtr, LowerLimit * Mathf.Deg2Rad, UpperLimit * Mathf.Deg2Rad);
        }
    }