예제 #1
0
 /// <summary>
 /// Adds new HUD warning to this group
 /// </summary>
 /// <param name="hudWarning">HUD warning to add</param>
 public void Add(MyHudWarning hudWarning)
 {
     m_hudWarnings.Add(hudWarning);
     SortByPriority();
     InitLastCuePlayed();
     hudWarning.CanPlay = () => m_highestWarnedPriority > hudWarning.WarningPriority || (m_msSinceLastCuePlayed > hudWarning.RepeatInterval && m_highestWarnedPriority == hudWarning.WarningPriority);
     hudWarning.Played  = () =>
     {
         m_msSinceLastCuePlayed  = 0;
         m_highestWarnedPriority = hudWarning.WarningPriority;
     };
 }
예제 #2
0
        public override void LoadData()
        {
            base.LoadData();
            if (MySandboxGame.IsDedicated)
            {
                return;
            }
            var list = new List <MyHudWarning>();
            //Health warnings
            var warning = new MyHudWarning((out MyGuiSounds cue, out MyStringId text) =>
                                           { cue = MyGuiSounds.HudVocHealthLow;  text = MyCommonTexts.NotificationHealthLow; return(HealthWarningMethod(MyCharacterStatComponent.LOW_HEALTH_RATIO * 2)); },
                                           1, 300000, 0, 2500);

            list.Add(warning);
            warning = new MyHudWarning((out MyGuiSounds cue, out MyStringId text) =>
                                       { cue = MyGuiSounds.HudVocHealthCritical;  text = MyCommonTexts.NotificationHealthCritical; return(HealthWarningMethod(MyCharacterStatComponent.LOW_HEALTH_RATIO)); },
                                       0, 300000, 0, 5000);
            list.Add(warning);
            var group = new MyHudWarningGroup(list, false);

            Add(group);
            list.Clear();
            //Energy warnings
            warning = new MyHudWarning(
                EnergyLowWarningMethod,
                2, 300000, 0, 2500);
            list.Add(warning);
            warning = new MyHudWarning(
                EnergyCritWarningMethod,
                1, 300000, 0, 5000);
            list.Add(warning);
            warning = new MyHudWarning(
                EnergyNoWarningMethod,
                0, 300000, 0, 5000);
            list.Add(warning);
            group = new MyHudWarningGroup(list, false);
            Add(group);
            list.Clear();

            //Meteor storm
            warning = new MyHudWarning(MeteorInboundWarningMethod,
                                       0, 10 * 60 * 1000, 0, 5000);
            list.Add(warning);
            group = new MyHudWarningGroup(list, false);
            Add(group);
        }
예제 #3
0
 /// <summary>
 /// Removes HUD warning from this group
 /// </summary>
 /// <param name="hudWarning">HUD warning to remove</param>
 public void Remove(MyHudWarning hudWarning)
 {
     m_hudWarnings.Remove(hudWarning);
 }
        public override void LoadData()
        {
            base.LoadData();
            if (MySandboxGame.IsDedicated)
                return;
            var list = new List<MyHudWarning>();
            //Health warnings
            var warning = new MyHudWarning((out MyGuiSounds cue, out MyStringId text) =>
                { cue = MyGuiSounds.HudVocHealthLow;  text = MyCommonTexts.NotificationHealthLow; return HealthWarningMethod(MyCharacterStatComponent.LOW_HEALTH_RATIO*2);},
                1, 300000, 0, 2500);
            list.Add(warning);
            warning = new MyHudWarning((out MyGuiSounds cue, out MyStringId text) =>
                { cue = MyGuiSounds.HudVocHealthCritical;  text = MyCommonTexts.NotificationHealthCritical; return HealthWarningMethod(MyCharacterStatComponent.LOW_HEALTH_RATIO); },
                 0, 300000, 0, 5000);
            list.Add(warning);
            var group = new MyHudWarningGroup(list, false);
            Add(group);
            list.Clear();
            //Energy warnings
            warning = new MyHudWarning(
                EnergyLowWarningMethod,
                2, 300000, 0, 2500);
            list.Add(warning);
            warning = new MyHudWarning(
               EnergyCritWarningMethod,
               1, 300000, 0 , 5000);
            list.Add(warning);
            warning = new MyHudWarning(
               EnergyNoWarningMethod,
               0, 300000, 0, 5000);
            list.Add(warning);
            group = new MyHudWarningGroup(list, false);
            Add(group);
            list.Clear();

            //Meteor storm
            warning = new MyHudWarning(MeteorInboundWarningMethod,
                0, 10 * 60 * 1000, 0, 5000);
            list.Add(warning);
            group = new MyHudWarningGroup(list, false);
            Add(group);
        }
 /// <summary>
 /// Removes HUD warning from this group
 /// </summary>
 /// <param name="hudWarning">HUD warning to remove</param>
 public void Remove(MyHudWarning hudWarning)
 {
     m_hudWarnings.Remove(hudWarning);
 }
 /// <summary>
 /// Adds new HUD warning to this group
 /// </summary>
 /// <param name="hudWarning">HUD warning to add</param>
 public void Add(MyHudWarning hudWarning)
 {
     m_hudWarnings.Add(hudWarning);
     SortByPriority();
     InitLastCuePlayed();
     hudWarning.CanPlay = () => m_highestWarnedPriority > hudWarning.WarningPriority|| (m_msSinceLastCuePlayed > hudWarning.RepeatInterval && m_highestWarnedPriority == hudWarning.WarningPriority);
     hudWarning.Played = () =>
         {
             m_msSinceLastCuePlayed = 0;
             m_highestWarnedPriority = hudWarning.WarningPriority;
         };
 }