Speech.Speak C# (CSharp) Method

Speak() public method

public Speak ( string speech ) : void
speech string
return void
    public void Speak(string speech)
    {
        try
        {
            if (!string.IsNullOrEmpty(speech))
            {
                synth.SpeakAsyncCancelAll();
                synth.SpeakAsync(speech.ToLower());
            }
            else synth.SpeakAsyncCancelAll();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Error Speaking", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }

Usage Example

Beispiel #1
0
        private void Obj_AI_Base_OnCreate(GameObject sender, EventArgs args)
        {
            if (!IsActive())
            {
                return;
            }

            foreach (Obj_AI_Hero hero in ObjectManager.Get <Obj_AI_Hero>())
            {
                if (hero.IsEnemy)
                {
                    foreach (var ability in Abilities)
                    {
                        if (sender.Name.Contains(ability.Key.SpellName))
                        {
                            ability.Key.Casted     = true;
                            ability.Key.TimeCasted = (int)Game.ClockTime;
                            if (SpellTimer.GetMenuItem("SAssembliesTimersSpellSpeech").GetValue <bool>())
                            {
                                Speech.Speak(ability.Key.Name + " casted on " + hero.ChampionName);
                            }
                            CreateText(ability.Key, hero, sender);
                        }
                    }
                }
            }
        }
All Usage Examples Of Speech::Speak