void OnMissionUpdateVars(ref MyEventMissionUpdateVars msg)
        {
            var missionId = (MyMissionID)msg.MissionId;

            if (!MyMwcEnums.IsValidValue <MyMissionID>(missionId))
            {
                Alert("Invalid mission id!", msg.SenderEndpoint, msg.EventType);
                return;
            }

            var mission = MyMissions.GetMissionByID((MyMissionID)msg.MissionId);

            mission.MissionTimer.SetElapsedTime(TimeSpan.FromMilliseconds(msg.ElapsedTime));
        }
        public void UpdateMissionVars()
        {
            if (MyMissions.ActiveMission != null)
            {
                foreach (var objective in MyMissions.ActiveMission.ActiveObjectives)
                {
                    // Objective timer, update once per 3s
                    var msg = new MyEventMissionUpdateVars();
                    msg.ElapsedTime = (int)objective.MissionTimer.GetElapsedTime().TotalMilliseconds;
                    msg.MissionId   = (int)MyMissions.ActiveMission.ID;
                    Peers.SendToAll(ref msg, Multiplayer.MyUpdateTypeId.Mission, (uint)objective.ID, 0.33f, NetDeliveryMethod.ReliableOrdered);
                }

                // Mission timer, update once per 10s
                var msgMission = new MyEventMissionUpdateVars();
                msgMission.ElapsedTime = (int)MyMissions.ActiveMission.MissionTimer.GetElapsedTime().TotalMilliseconds;
                msgMission.MissionId   = (int)MyMissions.ActiveMission.ID;
                Peers.SendToAll(ref msgMission, Multiplayer.MyUpdateTypeId.Mission, (uint)MyMissions.ActiveMission.ID, 0.1f, NetDeliveryMethod.ReliableOrdered);
            }
        }