Example #1
0
 public static void SetSavedRigidBodies(string levelName)
 {
     if (levelInfos.ContainsKey(levelName))
     {
         List <SavedRigidBodyInfo> list = levelInfos[levelName];
         if (list != null)
         {
             foreach (SavedRigidBodyInfo item in list)
             {
                 GameObject gameObject = GameObject.Find(item.restartableRigidName);
                 if (gameObject != null)
                 {
                     RestartableRigid component = gameObject.GetComponent <RestartableRigid>();
                     if (component != null)
                     {
                         component.SetRecordedInfo(item.rigidBodyName, item.pos, item.rot);
                     }
                 }
             }
         }
     }
 }
Example #2
0
    public void Respawn()
    {
        if (ReplayRecorder.isPlaying || NetGame.isClient || GrabManager.IsGrabbedAny(base.gameObject))
        {
            return;
        }
        RestartableRigid component = GetComponent <RestartableRigid>();

        if (component != null)
        {
            component.Reset(Vector3.up * respawnHeight);
            return;
        }
        base.transform.position = startPos + Vector3.up * respawnHeight;
        base.transform.rotation = startRot;
        Rigidbody component2 = GetComponent <Rigidbody>();

        if (component2 != null)
        {
            component2.velocity        = Vector3.zero;
            component2.angularVelocity = Vector3.zero;
        }
    }