public async Task <string> GatherCallback() { string json; using (var reader = new StreamReader(Request.Body)) { json = await reader.ReadToEndAsync(); } dynamic gatherEvent = JsonConvert.DeserializeObject <dynamic>(json); string digits = gatherEvent.digits; const string SUCCESS_FILE = "https://bw-demo.s3.amazonaws.com/tada.wav"; const string FAIL_FILE = "https://bw-demo.s3.amazonaws.com/fail.wav"; string media = digits.Equals("11") ? SUCCESS_FILE : FAIL_FILE; PlayAudio playAudio = new PlayAudio(); playAudio.Url = media; Hangup hangup = new Hangup(); Response response = new Response(); response.Add(playAudio); response.Add(hangup); string bxml = response.ToBXML(); return(bxml); }
private static void InteractWithMob() { PlayAudio.YouAreFucked(); Print.PrintMessageWithAudio("You have encountered a Mob!"); Print.PrintMessageWithAudio("Do you want to fight?"); string input = Console.ReadLine(); if (input.ToLower().Contains("yes")) { RandomEnemyGenerator mobGenerator = new RandomEnemyGenerator(player.Level, 'O'); List <Enemy> mob = mobGenerator.EnemiesList; BattleEngineV2 battleEngine = new BattleEngineV2(player, mob); battleEngine.Run(); if (player.IsAlive) { isMapEnementForRemove = true; } player.CalculateLevelByExperience(); } else { PlayAudio.Laugh(); PlayAudio.YouPussy(); Print.PrintMessageWithAudio("You will live to fight another day, you coward!"); } }
public ActionResult CallInitiatedCallback() { _logger.LogInformation($"{Request.Path.Value} requested."); var unavailableSpeakSentence = new SpeakSentence { Sentence = "You have reached Vandelay Industries, Kal Varnsen is unavailable at this time." }; var messageSpeakSentence = new SpeakSentence { Sentence = "At the tone, please record your message, when you have finished recording, you may hang up." }; var playAudio = new PlayAudio { Url = "/files/tone" }; var record = new Record { RecordingAvailableUrl = "/callbacks/recordingAvailableCallback" }; var response = new Response( unavailableSpeakSentence, messageSpeakSentence, playAudio, record ); return(new OkObjectResult(response.ToBXML())); }
private void Update() { if (SceneManager.GetActiveScene().name.Equals("MainMenu")) { PlayAudio?.Invoke("ThemeSong", 0f); StopAudio?.Invoke("ExpositionSong"); StopAudio?.Invoke("GameSong"); } if (SceneManager.GetActiveScene().name.Equals("Exposition")) { PlayAudio?.Invoke("ExpositionSong", 0f); StopAudio?.Invoke("ThemeSong"); StopAudio?.Invoke("GameSong"); } if (SceneManager.GetActiveScene().name.Equals("GGJ")) { PlayAudio?.Invoke("GameSong", 0f); StopAudio?.Invoke("ExpositionSong"); StopAudio?.Invoke("ThemeSong"); } if (input == null) { input = FindObjectOfType <InputController>(); SubscribeToInput(input); } if (MissedDeliveries >= LoseState) { GameOver(Score); } }
void Start() { random = new Random(); lastTime = Time.time; delay = 0.02f; ////get audio components for voice lines //voiceLines = new VoiceLines("VoiceLines/"); voiceSource = GameObject.FindGameObjectWithTag("VoiceHolder"); playAudioScript = voiceSource.GetComponent <PlayAudio>(); try { dataHolder = GameObject.Find("DataHolder").GetComponent <DataHolder>(); fileName = dataHolder.fileName; playerName = dataHolder.player.PlayerName; } catch (Exception e) { Debug.Log(e.ToString()); endPanel.GetComponentInChildren <TextMeshProUGUI>().text = "Please start game from main menu only!"; endPanel.SetActive(true); } string jsonString = Resources.Load <TextAsset>("Conversations/" + fileName.Replace(".json", "")).ToString(); currentConversation = JsonConvert.DeserializeObject <Conversation>(jsonString); LoadCharacters(); NextMessage(); }
void OnMouseOver() { thisRenderer.sprite = elementSprites[1]; if (!source.isPlaying && isOnArea) { if (Input.GetMouseButtonDown(0)) { playerAnimator.Play("Take", -1, 0); playerRigidbody.velocity = new Vector2(0, 0); source.PlayOneShot(audio); if (this.gameObject.name == "Box") { this.gameObject.transform.localEulerAngles = new Vector3(0, 0, 50); } foreach (MonoBehaviour script in startScripts) script.enabled = true; bedToyScript = GameObject.Find("BedToy").GetComponent<PlayAudio>(); bearScript = GameObject.Find("Bear").GetComponent<PlayAudio>(); horseScript = GameObject.Find("ToyCar").GetComponent<PlayAudio>(); if (bedToyScript.source.isPlaying && bearScript.source.isPlaying && horseScript.source.isPlaying) { successScript.enabled = true; } else { GameObject.Find("SpeachCanvas").GetComponent<Canvas>().enabled = false; } } } }
void Start() { animations = GetComponent <AnimationHandler>(); questionGenerator = GetComponent <QuestionGenerator>(); profile = GameObject.Find("ProfileData").GetComponent <Profile>(); audioScript = GameObject.Find("AudioManager").GetComponent <PlayAudio>(); }
public SCREEN(ConfigMrw mrwConfig) { configMrw = mrwConfig; if (mrwConfig.height_screen > 0 && mrwConfig.width_screen > 0) { widthScreen = mrwConfig.width_screen; heightScreen = mrwConfig.height_screen; } InitializeComponent(mrwConfig.text_run, mrwConfig.width_screen, mrwConfig.height_screen, configMrw.size_num, configMrw.size_xmdqs); this.wmpVideo.stretchToFit = true; this.wmpVideo.uiMode = "none"; //InitializeComponent(); this.CenterToScreen(); drawUI(); SetFORM(false); ContructorParam(); loadVideo(mrwConfig.folder_video); Init(); playAudio = new PlayAudio(); playAudio.Init(mrwConfig); playAudio.DataReceived += reciveAudio; Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); }
void Awake() { PlayAudio playAudio = GetComponent <PlayAudio> (); SetValue(); playAudio.source.Stop(); // Avoid the click sound to play. }
void PlayThisAudioStatement(AudioClip clip) { PlayAudio clipPlayer = new PlayAudio(); clipPlayer = GameObject.FindWithTag("Player").GetComponent <PlayAudio>(); clipPlayer.PlayThisAudioClip(clip); }
/* * public void ShootTowardsMouse() * { * Vector2 worldMouse = Camera.main.ScreenToWorldPoint(Input.mousePosition); * Vector3 dir = new Vector3(worldMouse.x - m_Transform.position.x, * worldMouse.y - m_Transform.position.y, 0); * * //Debug.Log($"{v.normalized} {v}"); * * Vector3 spawnPosition = m_Transform.position + dir.normalized; * * GameObject newProjectile = Instantiate(projectileType, spawnPosition, Quaternion.identity) as GameObject; * * //newProjectile.GetComponent<Projectile>().m_Direction = dir.normalized; * } */ #endregion private void Start() { m_Transform = this.gameObject.transform; m_PlayAudio = this.GetComponent <PlayAudio>(); m_CanShoot = true; paused = false; GameController.pauseEvent.AddListener(PauseListener); }
private void Start() { m_Transform = this.gameObject.transform; m_Rigidbody2D = this.gameObject.GetComponent <Rigidbody2D>(); m_PlayAudio = this.GetComponent <PlayAudio>(); m_RemainingJumps = maxJumps; }
//update function done void PlayThisAudioStatement(AudioClip clip) { Debug.Log("pauseTime"); PlayAudio statement2player = new PlayAudio(); statement2player = GameObject.FindWithTag("Player").GetComponent <PlayAudio>(); statement2player.PlayThisAudioClip(clip); }
void Start() { _pause = GameObject.FindGameObjectWithTag(Tags.PAUSEOBJECT).GetComponent <Pause>(); _anim = GetComponent <Animator>(); _jumpAudio = GetComponent <PlayAudio>(); _rb2D = GetComponent <Rigidbody2D>(); _isGrounded = true; //Makes the player able to jump at the start of the game _jumpRect = new Rect(0, 0, Screen.width, Screen.height * 0.90f); //sets touchable area for jumping }
public async void TestPlayAudioFile() { var context = new MockContext <IPlayAudio>(); context.Arrange(m => m.PlayAudioAsync("id", The <PlayAudioData> .Is(d => IsValidPlayAudioFileData(d)), null)) .Returns(Task.FromResult(0)); var instance = new PlayAudio(context); await instance.PlayAudioFileAsync("id", "url"); }
// Start is called before the first frame update void Start() { dead = false; m_CurrentHealth = maxHealth; m_Rigidbody2D = this.GetComponent <Rigidbody2D>(); m_PlayAudio = this.transform.GetChild(2).GetComponent <PlayAudio>(); startColor = sr.color; damagedColor = new Color(startColor.r, startColor.g, startColor.b, opacity); }
public void OnRelease() { if (currentGrabItem != null) { currentGrabItem.Release(currentInput); currentGrabItem = null; CallAnimationTrigger?.Invoke("", null); PlayAudio?.Invoke("Release", 0f); } }
/** * Reply to an incoming call with a sentence and a gather */ public static void letsPlayAGame() { post("/incoming/call", (request, response) => { string json = ControllerHelpers.getBody(request); BandwidthCallbackMessageVoice callbackMessageVoice = APIHelper.JsonDeserialize <BandwidthCallbackMessageVoice>(json); string eventType = callbackMessageVoice.EventType; Response bxmlResponse = new Response(); if ("initiate".Equals(eventType)) { SpeakSentence speakSentence = new SpeakSentence(); speakSentence.Sentence = "lets play a game"; SpeakSentence speakSentence1 = new SpeakSentence(); speakSentence1.Sentence = "What is the sum of 2 plus 3. Enter the sum followed by the pound symbol."; Gather gather = new Gather(); gather.TerminatingDigits = "#"; gather.SpeakSentence = speakSentence1; //If the destination of the gather url is on the same server, a relative URL will work too //gather.GatherUrl = "/incoming/call"; gather.GatherUrl = host + "/incoming/call"; bxmlResponse.Add(speakSentence); bxmlResponse.Add(gather); } else if ("gather".Equals(eventType)) { string digits = callbackMessageVoice.Digits; PlayAudio playAudio; if ("5".Equals(digits)) { //Correct playAudio = new PlayAudio(); playAudio.Url = "https://www23.online-convert.com/dl/web2/download-file/58b6885c-7ecc-4a55-b7ed-8a849e96965e/Smartest%20man%20alive.wav"; } else { //Wrong playAudio = new PlayAudio(); playAudio.Url = "https://www8.online-convert.com/dl/web2/download-file/1eb741cf-9c40-4166-8a63-40cf70c06348/Never%20Gonna%20Give%20You%20Up%20Original.wav"; } bxmlResponse.Add(playAudio); } return(bxmlResponse.ToXml()); }); }
private List <int> m_playerControllerList; //contient la liste des joueurs prêts à jouer void Start() { m_playerControllerList = new List <int>(); m_audioComp = Camera.main.GetComponent <PlayAudio>(); for (int i = 0; i < 4; i++) //On initialise la pos de chaque joystick { m_playerPositionList[i] = 0; //0 = joystick non activé sur l'écran de sélection } }
private void OnTriggerStay2D(Collider2D collision) { if ((Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) && !PlayerManager.isLock()) { if (Action()) { PlayAudio.Play(SingletonTMono <PlayerManager> .Instance.gameObject, "Sound/交互成功提示音"); } //switch () } }
private void Awake() { if (instance != null && instance != this) { Destroy(gameObject); return; } else { instance = this; } }
public void PlayInfoClips() { if (trackableObjects.Count == 1) { playAudio = currentTrackedTarget.gameObject.GetComponentInChildren <PlayAudio>(); playAudio.PlayInfoClipOnClick(); if (userSettings != null) { userSettings.FadeBGMusicVolume(playAudio.GetAudioSource().clip.length + 0.5f); } } }
private void Start() { paused = false; GameController.pauseEvent.AddListener(PauseListener); m_PlayAudio = this.GetComponent <PlayAudio>(); m_Transform = this.gameObject.transform; m_Rigidbody2D = this.GetComponent <Rigidbody2D>(); m_PlatformEffector2D = this.GetComponent <PlatformEffector2D>(); m_Jumper = this.GetComponent <Jumper>(); insideBlock = false; crouching = false; playingSound = false; }
private void PrintShopItems() { PlayAudio.WelcomeToTheShop(); Console.WriteLine("<---S-H-O-P--->"); Console.WriteLine("{0} ---> Index[{1}] Price[{2}]", "Item", "ID", "Price"); for (int i = 0; i < shopInventory.Count; i++) { Console.WriteLine("{0} ---> {1} {2} gold", shopInventory[i].Id, i, shopInventory[i].Price); } Print.PrintMessage(string.Format("Available gold: {0}", player.Gold)); Console.WriteLine("{0}\n", new string('-', 10)); }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
private void Hurt(Collider2D collision) { m_CanBeHurt = false; //Debug.Log("!!!!!!!!!!!OnTrigher 12"); m_bloodNum--; Invoke("EndProtectTime", this.m_hurtProtectTime); Vector3 off = (this.transform.position - collision.transform.position).normalized * springBackFactor; m_rigidbody.velocity = Vector2.zero; m_rigidbody.AddForce(new Vector2(off.x, off.y), ForceMode2D.Impulse); PlayAudio.Play(this.gameObject, "Sound/受伤"); ShowBlood(); }
private void DetermineAudioCall() { if (isDashing) { PlayAudio?.Invoke("Dash", 0f); CallVFX?.Invoke(this.transform.position - new Vector3(0, 1, 0), Quaternion.identity, .1f); } else { if (currentInput != Vector2.zero) { PlayAudio?.Invoke("Walking", .1f); } } }
void MakeThisTheOnlyGameManager() { if (playAudio == null) { DontDestroyOnLoad(gameObject); playAudio = this; } else { if (playAudio != this) { Destroy(gameObject); } } }
public void AddLexim(LeximDTView lexim, PlayAudio play) { ResourceDictionary resource = ((ResourceDictionary)((MyApplication)Application.Current).MyResources["resSliderStyle"]); SoundImage im = new SoundImage(); this.Children.Add(im); IntPtr intPt = lexim.Picture.GetHbitmap(); BitmapSource bs = Imaging.CreateBitmapSourceFromHBitmap(intPt, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(60, 45)); im.Style = resource["SoundImage"] as Style; im.Source = bs; im.AudioStream = lexim.Sound; im.Play = play; im.MouseEnter += new System.Windows.Input.MouseEventHandler(im_MouseEnter); baseWindow.DeleteObject(intPt); }
// Update is called once per frame void Update() { Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0.0f)); if (Physics.Raycast(ray, out _hit, rayCastDistance)) { } gameTime = gameTime + Time.deltaTime; pause = pause + Time.deltaTime; if (StatementCount == 0 & pause > 2.0f) { PlayAudio playFirstAudio = new PlayAudio(); playFirstAudio.PlayThisAudio(firstStatement); if (gameTime > firstStatement.clip.length) { StatementCount = 1; pause = 0.0f; Debug.Log("statement 1 complete"); } } if (StatementCount == 1 & pause > 2.0f) { Debug.Log("Pause is " + pause); MoveScriptAB moveGuide = new MoveScriptAB(); Vector3 init1Guide = guide.transform.position; Vector3 target1Guide = targetObject.transform.position; moveGuide.MoveObject(guide, init1Guide, target1Guide, speed); Vector3 init1Player = player.transform.position; Vector3 target1Player = player1target.transform.position; moveGuide.MoveObject(player, init1Player, target1Player, speed); gameObject.GetComponent <PlayerMovement>().enabled = true; ResetTime resetTime1 = new ResetTime(); resetTime1.Reset(pause); Debug.Log("pause is " + pause); } }
private ListBoxItem MapToItem(LeximDTView leximDT, PlayAudio play) { ResourceDictionary resource = ((ResourceDictionary)((MyApplication)Application.Current).MyResources["resLeximListBox"]); ListBoxItem lbi = new ListBoxItem(); lbi.Tag = leximDT.ID.ToString() + "_" + leximDT.ParentThemeID.ToString(); lbi.Template = resource["listBoxItem"] as ControlTemplate; StackPanel stackPanel = new StackPanel(); lbi.Content = stackPanel; stackPanel.Style = resource["stackListItem"] as Style; stackPanel.Orientation = Orientation.Horizontal; TextBlock tb = new TextBlock(); stackPanel.Children.Add(tb); tb.Text = leximDT.Word; tb.Style = resource["tbName"] as Style; tb.GotFocus += new RoutedEventHandler(tb_GotFocus); BitmapImage im = new BitmapImage(); stackPanel.Children.Add(im); im.Style = resource["imageListBox"] as Style; im.GDIBitmap = leximDT.Picture; IntPtr imagePointer = leximDT.Picture.GetHbitmap(); WriteableBitmap b = null; im.Source = Imaging.CreateBitmapSourceFromHBitmap(imagePointer, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(60, 45)); baseWindow.DeleteObject(imagePointer); AudioButton button = new AudioButton(); stackPanel.Children.Add(button); button.AudioStream = leximDT.Sound; button.Play = play; button.Style = resource["buttonListBox"] as Style; button.Template = (resource["tcPlayButton"] as ControlTemplate); button.Click += new RoutedEventHandler(button_Click); button.GotFocus += new RoutedEventHandler(button_GotFocus); return(lbi); }