private static void OnControlPilotMsg(MySyncCryoChamber syncObject, ref ControlPilotMsg msg, World.MyNetworkClient sender)
        {
            var playerId = new MyPlayer.PlayerId(msg.SteamId, msg.SerialId);
            var player = Sync.Players.TryGetPlayerById(playerId);

            var cryoChamber = syncObject.Entity as MyCryoChamber;

            if (player != null)
            {
                if (cryoChamber.Pilot != null)
                {
                    if (player == MySession.LocalHumanPlayer)
                    {
                        cryoChamber.OnPlayerLoaded();

                        if (MySession.Static.CameraController != cryoChamber)
                        {
                            MySession.SetCameraController(MyCameraControllerEnum.Entity, cryoChamber);
                        }
                    }
                 
                    player.Controller.TakeControl(cryoChamber);
                    player.Identity.ChangeCharacter(cryoChamber.Pilot);
                }
                else
                {
                    Debug.Fail("Selected cryo chamber doesn't have a pilot!");
                }
            }
            else
            {
                Debug.Fail("Failed to find player to put in cryo chamber!");
            }
        }
        private static void OnControlPilotMsg(MySyncCryoChamber syncObject, ref ControlPilotMsg msg, World.MyNetworkClient sender)
        {
            var playerId = new MyPlayer.PlayerId(msg.SteamId, msg.SerialId);
            var player   = Sync.Players.TryGetPlayerById(playerId);

            var cryoChamber = syncObject.Entity as MyCryoChamber;

            if (player != null)
            {
                if (cryoChamber.Pilot != null)
                {
                    if (player == MySession.LocalHumanPlayer)
                    {
                        cryoChamber.OnPlayerLoaded();

                        if (MySession.Static.CameraController != cryoChamber)
                        {
                            MySession.SetCameraController(MyCameraControllerEnum.Entity, cryoChamber);
                        }
                    }

                    player.Controller.TakeControl(cryoChamber);
                    player.Identity.ChangeCharacter(cryoChamber.Pilot);
                }
                else
                {
                    Debug.Fail("Selected cryo chamber doesn't have a pilot!");
                }
            }
            else
            {
                Debug.Fail("Failed to find player to put in cryo chamber!");
            }
        }
Beispiel #3
0
 protected override MySyncEntity OnCreateSync()
 {
     var sync = new MySyncCryoChamber(this);
     OnInitSync(sync);
     return sync;
 }