示例#1
0
        public static void SetupVessel(LaunchedVessel lv)
        {
            GameObject obj = new GameObject();

            DontDestroyOnLoad(obj);
            obj.AddComponent <MonoBehaviour>().StartCoroutine(setup_vessel(obj, lv));
        }
示例#2
0
文件: Hangar.cs 项目: kevin-ye/hangar
 //static coroutine launched from a DontDestroyOnLoad sentinel object allows to execute code while the scene is switching
 static IEnumerator<YieldInstruction> setup_vessel(UnityEngine.Object sentinel, LaunchedVessel lv)
 {
     while(!lv.launched) yield return new WaitForFixedUpdate();
     lv.tunePosition();
     lv.stiffenWheels();
     lv.transferCrew();
     //it seems you must give KSP a moment to sort it all out,
     //so delay the remaining steps of the transfer process.
     //(from the CrewManifest: https://github.com/sarbian/CrewManifest/blob/master/CrewManifest/ManifestController.cs)
     yield return new WaitForSeconds(0.25f);
     lv.vessel.SpawnCrew();
     Destroy(sentinel);
 }
示例#3
0
        //static coroutine launched from a DontDestroyOnLoad sentinel object allows to execute code while the scene is switching
        static IEnumerator <YieldInstruction> setup_vessel(UnityEngine.Object sentinel, LaunchedVessel lv)
        {
            while (!lv.launched)
            {
                yield return(new WaitForFixedUpdate());
            }
            lv.tunePosition();
            lv.stiffenWheels();
            lv.transferCrew();
            //it seems you must give KSP a moment to sort it all out,
            //so delay the remaining steps of the transfer process.
            //(from the CrewManifest: https://github.com/sarbian/CrewManifest/blob/master/CrewManifest/ManifestController.cs)
            yield return(new WaitForSeconds(0.25f));

            lv.vessel.SpawnCrew();
            Destroy(sentinel);
        }
示例#4
0
文件: Hangar.cs 项目: kevin-ye/hangar
 public static void SetupVessel(LaunchedVessel lv)
 {
     GameObject obj = new GameObject();
     DontDestroyOnLoad(obj);
     obj.AddComponent<MonoBehaviour>().StartCoroutine(setup_vessel(obj, lv));
 }