コード例 #1
0
 public virtual void Exit()
 {
     activePlayer = null;
     smoothTransform.SetDisabled();
 }
コード例 #2
0
ファイル: Multiplayer.cs プロジェクト: senlace/shinkai
        private IEnumerator LaunchGameAsync(ServerJoinInfo info)
        {
            uGUI_MainMenu.main.OnButtonSurvival();

            yield return(new WaitUntil(() => LargeWorldStreamer.main != null));

            yield return(new WaitUntil(() => LargeWorldStreamer.main.IsReady() || LargeWorldStreamer.main.IsWorldSettled()));

            yield return(new WaitUntil(() => !PAXTerrainController.main.isWorking));

            uGUI.main?.intro?.Stop(true);

            GuidHelper.Set(LargeWorldStreamer.main.globalRoot, info.globalRootGuid);
            GuidHelper.Set(Inventory.main.gameObject, info.equipmentGuid);

            var escapePod = EscapePod.main;

            if (escapePod != null)
            {
                escapePod.StartAtPosition(info.spawnPosition);

                var gameObject = escapePod.gameObject;
                GuidHelper.Set(gameObject, info.escapePodGuid);
                GuidHelper.Set(gameObject.GetComponentInChildren <Fabricator>(true)?.gameObject, info.fabricatorGuid);
                GuidHelper.Set(gameObject.GetComponentInChildren <MedicalCabinet>(true)?.gameObject, info.medkitGuid);
                GuidHelper.Set(gameObject.GetComponentInChildren <Radio>(true)?.gameObject, info.radioGuid);
            }

            UpdateServerTime(info.timestamp);

            Log.Info("Game loaded.");

            RemotePlayer.Initialize();

            self.loaded  = true;
            this.blocked = false;

            DevConsole.disableConsole = true;
            DevConsole.RegisterConsoleCommand(this, "mpdump", false, false);
            DevConsole.RegisterConsoleCommand(this, "mpsave", false, false);
            DevConsole.RegisterConsoleCommand(this, "mpsync", false, false);

            // Since I never got around to synchronizing door state, this is a hack to avoid
            // having to save progress for using ion cubes to open doors.
            foreach (var obj in UnityEngine.Object.FindObjectsOfType <PrecursorTeleporter>())
            {
                obj.isOpen = true;
                obj.ToggleDoor(true);
            }

            //Uncomment for developing.
            //DevConsole.disableConsole = false;
            //GameModeUtils.ActivateCheat(GameModeOption.NoCost);
            //GameModeUtils.ActivateCheat(GameModeOption.NoOxygen);
            //GameModeUtils.ActivateCheat(GameModeOption.NoSurvival);
            //CraftData.AddToInventory(TechType.Builder, 1, false, true);

            Send(new ClientGameReload());

            yield break;
        }
コード例 #3
0
 public virtual void Enter(RemotePlayer player)
 {
     activePlayer = player;
     smoothTransform.SetEnabled();
 }