コード例 #1
0
 /// <summary>
 /// Creates new instance of MyHudSoundWaring, with repeating
 /// </summary>
 /// <param name="sound">Sound to play</param>
 /// <param name="repeatInverval">Repeat sound in interval (in ms) ... for non repeat set to 0</param>
 /// <param name="initialDelay">Waiting time (in ms) before the sound plays when the condition is encountered</param>
 public MyHudSoundWarning(MySoundCuesEnum sound, int repeatInverval, int initialDelay = 0, bool playOverDialogues = true)
 {
     Sound                    = sound;
     RepeatInterval           = repeatInverval;
     m_msSinceLastStateChange = 0;
     m_warningState           = WarningState.NOT_STARTED;
     m_initialDelay           = initialDelay;
     m_playOverDialogues      = playOverDialogues;
 }
コード例 #2
0
ファイル: MyHudWarning.cs プロジェクト: Bunni/Miner-Wars-2081
 /// <summary>
 /// Creates new instance of MyHudSoundWaring, with repeating
 /// </summary>
 /// <param name="sound">Sound to play</param>
 /// <param name="repeatInverval">Repeat sound in interval (in ms) ... for non repeat set to 0</param>
 /// <param name="initialDelay">Waiting time (in ms) before the sound plays when the condition is encountered</param>
 public MyHudSoundWarning(MySoundCuesEnum sound, int repeatInverval, int initialDelay = 0, bool playOverDialogues = true)
 {
     Sound = sound;
     RepeatInterval = repeatInverval;
     m_msSinceLastStateChange = 0;
     m_warningState = WarningState.NOT_STARTED;
     m_initialDelay = initialDelay;
     m_playOverDialogues = playOverDialogues;
 }
コード例 #3
0
        /// <summary>
        /// Call it in each update
        /// </summary>
        /// <param name="isWarnedHigherPriority">Indicated if warning with greater priority was signalized</param>
        /// <returns>Returns true if warning detected. Else returns false</returns>
        public bool Update(bool isWarnedHigherPriority)
        {
            MyGuiSounds cue  = MyGuiSounds.None;
            MyStringId  text = MySpaceTexts.Blank;

            m_warningDetected = false;
            if (!isWarnedHigherPriority)
            {
                m_warningDetected = m_warningDetectionMethod(out cue, out text);
            }

            m_msSinceLastStateChange += VRage.Game.MyEngineConstants.UPDATE_STEP_SIZE_IN_MILLISECONDS * MyHudWarnings.FRAMES_BETWEEN_UPDATE;
            if (m_warningDetected)
            {
                switch (m_warningState)
                {
                case WarningState.NOT_STARTED:
                    Text = text;
                    MyHud.Notifications.Add(this);
                    m_msSinceLastStateChange = 0;
                    m_warningState           = WarningState.STARTED;
                    break;

                case WarningState.STARTED:
                    if (m_msSinceLastStateChange >= m_soundDelay && CanPlay())
                    {
                        MyHudWarnings.EnqueueSound(cue);
                        m_warningState = WarningState.PLAYED;
                        Played();
                    }
                    break;

                case WarningState.PLAYED:
                    if (RepeatInterval > 0)
                    {
                        if (CanPlay())
                        {
                            MyHud.Notifications.Remove(this);
                            MyHud.Notifications.Add(this);
                            MyHudWarnings.EnqueueSound(cue);
                            Played();
                        }
                    }
                    break;
                }
            }
            else
            {
                MyHud.Notifications.Remove(this);
                MyHudWarnings.RemoveSound(cue);
                m_warningState = WarningState.NOT_STARTED;
            }
            return(m_warningDetected);
        }
コード例 #4
0
ファイル: UIManager.cs プロジェクト: etcdotx/GATWarrior
 /// <summary>
 /// ienumerator lanjutan dari warningnotif
 /// akan automatis hilang tergantung durasi
 /// </summary>
 /// <param name="itemName">item yang berkaitan</param>
 /// <param name="warningState">kondisi warning</param>
 /// <returns></returns>
 IEnumerator ShowNotif(string itemName, WarningState warningState)
 {
     if (warningState == WarningState.itemFull)
     {
         warning.text = "You cannot carry more " + itemName + ".";
     }
     else if (warningState == WarningState.notEnoughMoney)
     {
         warning.text = "Not enough money to buy " + itemName + ".";
     }
     else if (warningState == WarningState.inventoryFull)
     {
         warning.text = "Inventory full.";
     }
     warning.gameObject.SetActive(true);
     yield return new WaitForSeconds(2);
     warning.gameObject.SetActive(false);
 }
コード例 #5
0
        /// <summary>
        /// Call it in each update.
        /// </summary>
        /// <param name="isWarningDetected">Indicates if warning is detected</param>
        public void Update(bool isWarningDetected)
        {
            if (isWarningDetected)
            {
                switch (m_warningState)
                {
                case WarningState.NOT_STARTED:
                    m_msSinceLastStateChange = 0;
                    m_warningState           = WarningState.STARTED;
                    break;

                case WarningState.STARTED:
                    m_msSinceLastStateChange += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS;
                    if (m_msSinceLastStateChange >= m_initialDelay)
                    {
                        PlaySound();
                        m_warningState            = WarningState.PLAYED;
                        m_msSinceLastStateChange -= m_initialDelay;
                    }
                    break;

                case WarningState.PLAYED:
                    if (RepeatInterval > 0)
                    {
                        m_msSinceLastStateChange += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS;
                        if (m_msSinceLastStateChange >= RepeatInterval)
                        {
                            PlaySound();
                            m_msSinceLastStateChange -= RepeatInterval;
                        }
                    }
                    break;
                }
            }
            else
            {
                if (m_soundCue != null && m_soundCue.Value.IsPlaying)
                {
                    m_soundCue.Value.Stop(SharpDX.XACT3.StopFlags.Release);
                }
                m_warningState = WarningState.NOT_STARTED;
            }
        }
コード例 #6
0
ファイル: MyHudWarning.cs プロジェクト: Bunni/Miner-Wars-2081
 /// <summary>
 /// Call it in each update.
 /// </summary>
 /// <param name="isWarningDetected">Indicates if warning is detected</param>
 public void Update(bool isWarningDetected)
 {
     if (isWarningDetected)
     {
         switch (m_warningState)
         {
             case WarningState.NOT_STARTED:
                 m_msSinceLastStateChange = 0;
                 m_warningState = WarningState.STARTED;
                 break;
             case WarningState.STARTED:
                 m_msSinceLastStateChange += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS;
                 if (m_msSinceLastStateChange >= m_initialDelay)
                 {
                     PlaySound();
                     m_warningState = WarningState.PLAYED;
                     m_msSinceLastStateChange -= m_initialDelay;
                 }
                 break;
             case WarningState.PLAYED:
                 if (RepeatInterval > 0)
                 {
                     m_msSinceLastStateChange += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS;
                     if (m_msSinceLastStateChange >= RepeatInterval)
                     {
                         PlaySound();
                         m_msSinceLastStateChange -= RepeatInterval;
                     }
                 }
                 break;
         }
     }
     else
     {
         if (m_soundCue != null && m_soundCue.Value.IsPlaying)
         {
             m_soundCue.Value.Stop(SharpDX.XACT3.StopFlags.Release);
         }
         m_warningState = WarningState.NOT_STARTED;
     }
 }
コード例 #7
0
    private void TransitionToWarningState(WarningState newWarningState)
    {
        this.warningState = newWarningState;

        switch (newWarningState)
        {
        case WarningState.NoWarning:
            enemyNumberBackgroundHighlighted.gameObject.SetActive(false);
            enemyProgressionHighlighted.gameObject.SetActive(false);
            break;

        case WarningState.WarningNoAttack:
            timeToChangeWarning = 0;
            ChangeWarning();
            break;

        case WarningState.WarningAttack:
            enemyNumberBackgroundHighlighted.gameObject.SetActive(true);
            enemyProgressionHighlighted.gameObject.SetActive(true);
            break;
        }
    }
コード例 #8
0
 public WarningStateMapEntry(int position, WarningState general, ImmutableDictionary <string, WarningState> specific)
 {
     this.Position              = position;
     this.GeneralWarningOption  = general;
     this.SpecificWarningOption = specific ?? ImmutableDictionary.Create <string, WarningState>();
 }
コード例 #9
0
        /// <summary>
        /// Call it in each update
        /// </summary>
        /// <param name="isWarnedHigherPriority">Indicated if warning with greater priority was signalized</param>
        /// <returns>Returns true if warning detected. Else returns false</returns>
        public bool Update(bool isWarnedHigherPriority)
        {
            MyGuiSounds cue = MyGuiSounds.None;
            MyStringId text = MySpaceTexts.Blank;
            m_warningDetected = false;
            if (!isWarnedHigherPriority)
                m_warningDetected = m_warningDetectionMethod(out cue, out text);

            m_msSinceLastStateChange += VRage.Game.MyEngineConstants.UPDATE_STEP_SIZE_IN_MILLISECONDS * MyHudWarnings.FRAMES_BETWEEN_UPDATE;
            if (m_warningDetected)
            {
                switch (m_warningState)
                {
                    case WarningState.NOT_STARTED:
                        Text = text;
                        MyHud.Notifications.Add(this);
                        m_msSinceLastStateChange = 0;
                        m_warningState = WarningState.STARTED;
                        break;
                    case WarningState.STARTED:
                        if (m_msSinceLastStateChange >= m_soundDelay && CanPlay())
                        {
                            MyHudWarnings.EnqueueSound(cue);
                            m_warningState = WarningState.PLAYED;
                            Played();
                        }
                        break;
                    case WarningState.PLAYED:
                        if (RepeatInterval > 0)
                        {
                            if (CanPlay())
                            {
                                MyHud.Notifications.Remove(this);
                                MyHud.Notifications.Add(this);
                                MyHudWarnings.EnqueueSound(cue);
                                Played();
                            }
                        }
                        break;
                }
            }
            else
            {
                MyHud.Notifications.Remove(this);
                MyHudWarnings.RemoveSound(cue);
                m_warningState = WarningState.NOT_STARTED;
            }
            return m_warningDetected;
        }
コード例 #10
0
        public override void UpdateAfterSimulation()
        {
            if (!MySandboxGame.IsGameReady)
            {
                return;
            }
            if (Game.IsDedicated)
            {
                return;
            }
            ++_mUpdateCounter;
            if (_mUpdateCounter % FRAMES_BETWEEN_UPDATE != 0)
            {
                return;
            }

            if (!MeteorShower.CurrentTarget.HasValue || MySession.Static.ControlledEntity == null)
            {
                M_SOUND_QUEUE.Clear();
                MyHud.Notifications.Remove(_notification);
                _mWarningState = WarningState.NotStarted;
                return;
            }

            var cue           = MyGuiSounds.HudVocMeteorInbound;
            var currentTarget = MeteorShower.CurrentTarget;
            var num1          = (double)Vector3.Distance(currentTarget.Value.Center,
                                                         MySession.Static.ControlledEntity.Entity.PositionComp.GetPosition());

            currentTarget = MeteorShower.CurrentTarget;
            var num2 = 2.0 * currentTarget.Value.Radius + 500.0;

            if (num1 < num2)
            {
                _mMsSinceLastCuePlayed += 16 * FRAMES_BETWEEN_UPDATE;
                switch (_mWarningState)
                {
                case WarningState.NotStarted:
                    MyHud.Notifications.Add(_notification);
                    _mWarningState = WarningState.Started;
                    break;

                case WarningState.Started:
                    EnqueueSound(cue);
                    _mWarningState         = WarningState.PLAYED;
                    _mMsSinceLastCuePlayed = 0;
                    break;

                case WarningState.PLAYED:
                    break;
                }
            }
            else
            {
                M_SOUND_QUEUE.Clear();
                MyHud.Notifications.Remove(_notification);
                _mWarningState = WarningState.NotStarted;
            }


            if (M_SOUND_QUEUE.Count <= 0 || MySandboxGame.TotalGamePlayTimeInMilliseconds - _mLastSoundPlayed <= 5000)
            {
                return;
            }
            _mLastSoundPlayed = MySandboxGame.TotalGamePlayTimeInMilliseconds;
            _mSound           = MyGuiAudio.PlaySound(M_SOUND_QUEUE[0]);
            M_SOUND_QUEUE.RemoveAt(0);
        }
コード例 #11
0
ファイル: WarningManager.cs プロジェクト: kittinap/kunnjae
        /// <summary>
        /// Controls the state of a particular warning.
        /// </summary>
        public void SetState(int warningNumber, WarningState state)
        {
            Contract.Requires(warningNumber >= 0);

            m_warningStates[warningNumber] = state;
        }
コード例 #12
0
ファイル: Soul.cs プロジェクト: rodstrom/soul
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Intro sounds
            audioManager.addEffect(audioList.getValue("Intro", "startup"), "intro_startup");

            // Main Menu Sounds
            audioManager.addEffect(audioList.getValue("MainMenu", "move"), "menu_move");
            audioManager.addEffect(audioList.getValue("MainMenu", "select"), "menu_select");
            audioManager.addEffect(audioList.getValue("MainMenu", "start"), "menu_start");
            audioManager.addSong(audioList.getValue("MainMenu", "music"), "menu_music");

            // World Map Sounds
            audioManager.addEffect(audioList.getValue("WorldMap", "select"), "map_select");
            audioManager.addEffect(audioList.getValue("WorldMap", "move"), "map_move");
            audioManager.addEffect(audioList.getValue("WorldMap", "selectMap"), "map_select_map");
            audioManager.addEffect(audioList.getValue("WorldMap", "back"), "map_back");
            audioManager.addSong(audioList.getValue("WorldMap", "music"), "map_music");

            // In Game Sounds
            audioManager.addEffect(audioList.getValue("InGame", "player_shoot"), "player_shoot");
            audioManager.addEffect(audioList.getValue("InGame", "player_die"), "player_die");
            audioManager.addEffect(audioList.getValue("InGame", "player_powerup_pickup"), "player_powerup_pickup");
            audioManager.addEffect(audioList.getValue("InGame", "dark_thought_shoot"), "dark_thought_shoot");
            audioManager.addEffect(audioList.getValue("InGame", "dark_thought_die"), "dark_thought_die");
            audioManager.addEffect(audioList.getValue("InGame", "red_bloodvessel_die"), "red_bloodvessel_die");
            audioManager.addEffect(audioList.getValue("InGame", "blue_bloodvessel_die"), "blue_bloodvessel_die");
            audioManager.addEffect(audioList.getValue("InGame", "purple_bloodvessel_die"), "purple_bloodvessel_die");
            audioManager.addEffect(audioList.getValue("InGame", "nightmare_die"), "nightmare_die");
            audioManager.addEffect(audioList.getValue("InGame", "nightmare_hit"), "nightmare_hit");
            audioManager.addEffect(audioList.getValue("InGame", "inner_demon_die"), "inner_demon_die");
            audioManager.addEffect(audioList.getValue("InGame", "lesser_demon_spawn"), "lesser_demon_spawn");
            audioManager.addEffect(audioList.getValue("InGame", "lesser_demon_die"), "lesser_demon_die");
            audioManager.addEffect(audioList.getValue("InGame", "dark_whisper_die"), "dark_whisper_die");
            audioManager.addEffect(audioList.getValue("InGame", "dark_whisper_release_spikes"), "release_spikes");
            audioManager.addEffect(audioList.getValue("InGame", "pause_appear"), "pause_appear");
            audioManager.addSong(audioList.getValue("InGame", "music"), "main_music");
            audioManager.addSong(audioList.getValue("InGame", "music_secondary"), "secondary_music");

            stateManager = new StateManager();

            controls = new InputManager(this);
            State state = new IntroState(spriteBatch, this, audioManager, controls, "IntroState");
            stateManager.AddState(state);
            state = new MenuState(spriteBatch, this, graphics, displayModes, audioManager, controls, "MenuState");
            stateManager.AddState(state);
            state = new CreditsState(spriteBatch, this, audioManager, controls, "CreditsState");
            stateManager.AddState(state);
            state = new WorldMapState(spriteBatch, this, audioManager, controls, "WorldMapState");
            stateManager.AddState(state);
            state = new PlayState(spriteBatch, this, audioManager, controls, "PlayState");
            stateManager.AddState(state);
            state = new WarningState(spriteBatch, this, audioManager, controls, "WarningState");
            stateManager.AddState(state);
            stateManager.SetState(config.getValue("General", "StartState"));
        }
コード例 #13
0
 public WarningStateMapEntry(int position)
 {
     this.Position              = position;
     this.GeneralWarningOption  = default(WarningState);
     this.SpecificWarningOption = new Dictionary <string, WarningState>();
 }
コード例 #14
0
 public WarningStateMapEntry(int position)
 {
     this.Position              = position;
     this.GeneralWarningOption  = default;
     this.SpecificWarningOption = ImmutableDictionary.Create <string, WarningState>();
 }
コード例 #15
0
ファイル: UIManager.cs プロジェクト: etcdotx/GATWarrior
 /// <summary>
 /// function untuk menunjukkan warning di game
 /// </summary>
 /// <param name="itemName">item yang berkaitan</param>
 /// <param name="warningState">kondisi warning</param>
 public void WarningNotification(string itemName, WarningState warningState) {
     StopCoroutine("ShowNotif");
     StartCoroutine(ShowNotif(itemName, warningState));
 }
コード例 #16
0
 protected override void CreateStates()
 {
     StatePreRun = new PreRunState(this);
     StateRun = new RunState(this);
     StatePreStop = new PreStopState(this);
     StateStop = new StopState(this);
     StatePreInitialize = new PreInitializeState(this);
     StateInitialize = new InitializeState(this);
     StateRundown = new RundownState(this);
     StatePreEmergency = new PreEmergencyState(this);
     StateEmergency = new EmergencyState(this);
     StateEmergencyReset = new EmergencyResetState(this);
     StatePreAlarm = new PreAlarmState(this);
     StateAlarm = new AlarmState(this);
     StatePreWarning = new PreWarningState(this);
     StateWarning = new WarningState(this);
     StatePreSuspend = new PreSuspendState(this);
     StateSuspend = new SuspendState(this);
 }
コード例 #17
0
 public WarningStateMapEntry(int position, WarningState general, Dictionary <string, WarningState> specific)
 {
     this.Position              = position;
     this.GeneralWarningOption  = general;
     this.SpecificWarningOption = specific ?? new Dictionary <string, WarningState>();
 }