public static void GifNotification(DisplayWindow window, int displayTime, string imagineFile, string soundFile, int textheight, string content) { int oWidth = window.Width; int oHeight = window.Height; ImagineRequest imagineRender = new ImagineRequest() { x = 0, y = 0, width = oWidth, height = oHeight - (textheight * 2), }; imagineRender.SetFromFile(imagineFile); TextRequest textRender = new TextRequest() { x = 5, y = oHeight - (textheight * 2), width = oWidth - 5, height = textheight, autoResize = true, text = content, }; SoundRequest soundRequest = new SoundRequest() { file = soundFile }; RenderRequest request = new RenderRequest(displayTime, soundRequest, imagineRender, textRender); window.EnqueueRenders(request); }
private void DoorAction() { if (state == InteractableState.negative) { anim.SetBool("Open", true); state = InteractableState.positive; SoundRequest.RequestSound("Open"); StopAllCoroutines(); if (referenceID != -1) { ActionReleaseDoorLock(this, referenceID); } } else { anim.SetBool("Open", false); state = InteractableState.negative; SoundRequest.RequestSound("Close"); cannotBeOpened = true; StartCoroutine(Unlock()); } }
public override void OnEnter(Enemy theEnemy) { theEnemy.PlayerFar(); theEnemy.wasKnockedOut = true; enemy = theEnemy; transitions = new List <Transition> { new WakeUpAlertTransition(enemy), new WakeUpStealthTransition(enemy), }; enemy.particle.SetActive(true); enemy.GetComponent <NavMeshAgent>().enabled = false; enemy.health.ZeroOutHealth(); enemy.fov.DisableFOV(); enemy.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; enemy.timeWhenKnockedOut = Time.time; SoundRequest.RequestSound("Power_Down"); //Make sure the body doesn't get in the way of guards enemy.GetComponent <BoxCollider>().enabled = false; }
private IEnumerator ShowObjectives() { int count = 0; int max = gameStats.objectList.Count; int moneyCount = 0; moneyText.text = "$" + moneyCount.ToString(); while (count < max) { if (!skipPress) { yield return(new WaitForSecondsRealtime(0.075f)); SoundRequest.RequestSound("Punch"); } // Spawn next object in list LootObject lo = gameStats.objectList[count]; Instantiate(ImageFromID(lo.ID), grid); moneyCount += lo.price; moneyText.text = "$" + moneyCount.ToString(); count++; } skipPress = true; }
public void StopSound(SoundRequest request, float delay = 0) { if (request != null && soundPlayersDictionary.ContainsKey(request.ID)) { StopSound(soundPlayersDictionary[request.ID], delay); } }
public override void TakeDamage(int damage) { ActionDamageHappened(); ActionTakeDamage(damage); base.TakeDamage(damage); SoundRequest.RequestSound("Hit_Sound"); }
public override void PressButton() { base.PressButton(); ActionStartButtonPressed(); FindObjectOfType <AudienceInteractableManager>().SetReadyToPlay(); SoundRequest.RequestMusic("Game_Music"); }
public void InteractWith(PlayerController interactingPlayer) { // Add money to player ActionCollected(StringFromType(type), transform.position); SoundRequest.RequestSound("Collect"); // Cleanup ActionPlayerClose(this, false); Destroy(gameObject); }
private void DoKnockout() { animator.SetBool("Knockout", true); SoundRequest.RequestSound("Swing_Heavy"); canMove = false; canAttack = false; canDodgeRoll = false; SpawnSlash(); StartCoroutine(FinishKnockout()); }
public override void TakeDamage(int damage) { base.TakeDamage(damage); ActionTakeDamage(damage); ActionDamageTaken(); SoundRequest.RequestSound("Punch"); ActionDamagePop(gameObject, damage, true, false); }
public void Tripped() { ActionLineCrossed(); SecureRoom room = (SecureRoom)parentRoom; SoundRequest.RequestSound("Zap"); //if (!room.hasAlerted) //{ // room.NotifyEnemiesOfPlayer(); //} }
private IEnumerator Attack() { yield return(new WaitForSeconds(0.2f)); if (!wasKnockedOut) { GetComponent <Attack>().DoAttack(damage); SoundRequest.RequestSound("Guard_Swing"); modelAnim.SetBool("Attack", false); } attacked = true; }
public void InteractWith(PlayerController interactingPlayer) { // Add money to player ActionCollected(SideObjective.StringFromType(type), transform.position); ActionLockDown(); SoundRequest.RequestSound("Collect"); SoundRequest.RequestSound("Lockdown"); SoundRequest.RequestMusic("Intense_Music"); Camera.main.GetComponent <ScreenShake>().Shake(screenShakeAmount); // Cleanup ActionPlayerClose(this, false); Destroy(gameObject); }
private void Start() { currentSelection = 0; buttons = new MenuButton[3]; buttons[0] = transform.GetChild(0).GetChild(0).GetComponent <MenuButton>(); buttons[1] = transform.GetChild(0).GetChild(1).GetComponent <MenuButton>(); buttons[2] = transform.GetChild(0).GetChild(2).GetComponent <MenuButton>(); buttons[0].Init(true); buttons[1].Init(false); buttons[2].Init(false); SoundRequest.RequestMusic("Menu_Music"); }
public void NotifyEnemiesOfPlayer() { hasAlerted = true; alertQuad.SetActive(true); SoundRequest.RequestSound("Surprised"); foreach (Enemy e in enemiesOwnedByRoom) { e.NotifyOfPlayer(); } AlertCameras(); }
private void NextAttackAnimation(int animNum) { rb.AddForce(transform.forward * forwardAttackMovement); animator.SetInteger("Animation", animNum); attackNum = animNum; timeWhenAttacked = Time.time; if (attackNum == 2) { SoundRequest.RequestSound("Swing_Heavy"); } else { SoundRequest.RequestSound("Swing_Light"); } //Check Crit if (UnityEngine.Random.Range(0, critChance) == 0) { int damage = damageAmounts[0, attackNum] * critMultiplier; GameObject enemy = attackScript.DoAttack(damage); //MAKE DAMAGE POPOFF if (enemy != null) { ActionDamagePop(enemy, damage, false, true); } } else { GameObject enemy = attackScript.DoAttack(damageAmounts[0, attackNum]); if (enemy != null) { ActionDamagePop(enemy, damageAmounts[0, attackNum], false, false); } } SpawnSlash(); canAttack = true; //isAttacking = true; canDodgeRoll = false; }
private void Update() { if (controller != null) { if (controller.DPadDown.WasPressed || controller.LeftStickDown.WasPressed) { buttons[currentSelection].ButtonActive(false); ++currentSelection; if (currentSelection > 2) { currentSelection = 0; } SoundRequest.RequestSound("Menu_Browse"); buttons[currentSelection].ButtonActive(true); } else if (controller.DPadUp.WasPressed || controller.LeftStickUp.WasPressed) { buttons[currentSelection].ButtonActive(false); --currentSelection; if (currentSelection < 0) { currentSelection = 2; } SoundRequest.RequestSound("Menu_Browse"); buttons[currentSelection].ButtonActive(true); } else if (controller.Action1.WasPressed) { buttons[currentSelection].PressButton(); } } controller = null; }
public AudioClip GetSoundByRequest(SoundRequest sr) { switch (sr) { case SoundRequest.P_Knock: return(GetPlayerKnockSound()); case SoundRequest.P_OpenDoor: return(GetPlayerOpenDoorSound()); case SoundRequest.P_ButtonPush: return(GetPlayerButtonPushSound()); case SoundRequest.E_Cry: return(GetEnemyCrySound()); } return(null); }
public AudioClip GetSoundByRequest(SoundRequest sr) { //Example: switch (sr) { case SoundRequest.P_HereCall: return(GetHereSound()); case SoundRequest.P_StopCall: return(GetStopSound()); case SoundRequest.P_ActionCall: return(GetActionSound()); case SoundRequest.P_OpenDoor: return(GetOpenDoorSound()); case SoundRequest.P_StepSound: return(GetStepSound()); case SoundRequest.P_HitSound: return(GetHitSound()); case SoundRequest.P_Stress: return(GetStressSound()); case SoundRequest.E_Scape: return(GetEnemyScapeSound()); case SoundRequest.E_Distortion: return(GetEnemyDistortionSound()); case SoundRequest.C_Sounds: return(GetCarsSound()); case SoundRequest.P_Behind: return(GetBehindSound()); } return(null); }
private void DoDodgeRoll() { if (rb.velocity.magnitude < 5) { canDodgeRoll = false; canAttack = false; canMove = false; foreach (int i in layerInts) { Physics.IgnoreLayerCollision(i, 10, true); } animator.SetBool("DodgeRoll", true); SoundRequest.RequestSound("Roll"); rb.AddForce(transform.forward * dodgeRollSpeed); StartCoroutine(FinishDodgeRoll()); } }
void Start() { // targetMenu = GameObject.FindGameObjectWithTag("TargetMenu").GetComponent<Dropdown>(); selectedInfoPane = GameObject.FindGameObjectWithTag("InfoPane"); leftPanel = GameObject.FindGameObjectWithTag("LeftPane"); rightPanel = GameObject.FindGameObjectWithTag("RightPane"); audioSystem = GameObject.FindObjectOfType <SoundRequest>(); if (audioSystem == null) { Debug.LogError("No sound manager was found!"); } // selectedInfoPane.SetActive(false); instance = this; turnMarker = Instantiate(turnMarker); // targetMenu.AddOptions(enemyNames); resetStage(); }
public void InteractWith(PlayerController interactingPlayer) { PlayerHealth health = interactingPlayer.GetComponent <PlayerHealth>(); if (health.GetCurrHealth() < health.maxHealth) { // Play Sound SoundRequest.RequestSound("Heal"); health.HealPlayer(interactingPlayer, healAmount, healPerTick); ActionHealthPackUsed(); ActionPlayerClose(this, false); Destroy(gameObject); } else { SoundRequest.RequestSound("Deny"); canvas.gameObject.SetActive(true); ActionPlayerClose(this, false); } }
public SoundRequest StartSound(string soundName) { SoundGroup group = library.GetSoundGroupFromName(soundName); if (group == null) { Debug.LogError("Soundgoup '" + soundName + "' not found!"); return(null); } if (group.deadTime > 0 && nextTimeAllowed[group.groupID] > Time.unscaledTime) { return(null); } if (soundPlayersOfGroupCount[group.groupID] >= group.maxSoursesCount) { return(null); } int index = GetVacantAudioSourseIndex(); if (index < 0) { return(null); } SoundRequest request = new SoundRequest(); SoundPlayer soundPlayer; if (group.loop && group.loopMode == SoundLoopMode.Crossfade) { int index2 = GetVacantAudioSourseIndex(); if (index2 < 0) { DeactivateSourse(index); return(null); } if (group.deadTime > 0) { nextTimeAllowed[group.groupID] = Time.unscaledTime + group.deadTime; } soundPlayersOfGroupCount[group.groupID] += 1; soundPlayer = new SoundPlayer(request.ID, group.groupID, sourseKeepers[index], index, sourseKeepers[index2], index2); soundPlayer.interruptible = true; soundPlayer.sourseKeeper.sourse.clip = group.GetClip(); soundPlayer.fadeOutTime = group.fadeOutTime; soundPlayer.sourseKeeper.sourse.loop = false; soundPlayer.secondSourseKeeper.sourse.loop = false; if (group.randomize) { soundPlayer.sourseKeeper.sourse.pitch = 1 + (Random.value - 0.5f) * group.pitchRndValue; soundPlayer.sourseKeeper.SetMultiplier(group.volume * (1 - Random.value * group.volumeRndValue)); } else { soundPlayer.sourseKeeper.sourse.pitch = 1; soundPlayer.sourseKeeper.SetMultiplier(group.volume); } soundPlayer.secondSourseKeeper.sourse.clip = soundPlayer.sourseKeeper.sourse.clip; soundPlayer.secondSourseKeeper.sourse.pitch = soundPlayer.sourseKeeper.sourse.pitch; soundPlayer.secondSourseKeeper.SetMultiplier(soundPlayer.sourseKeeper.VoulumeMultiplier); soundPlayer.duration = soundPlayer.sourseKeeper.sourse.clip.length / soundPlayer.sourseKeeper.sourse.pitch * group.maxLoopCount; soundPlayer.crossFadeLoop = true; soundPlayer.playCoroutine = StartCoroutine(LoopCrossFade(soundPlayer, group.fadeStartTime, group.fadeDuration)); soundPlayersDictionary.Add(request.ID, soundPlayer); } else { if (group.deadTime > 0) { nextTimeAllowed[group.groupID] = Time.unscaledTime + group.deadTime; } soundPlayersOfGroupCount[group.groupID] += 1; soundPlayer = new SoundPlayer(request.ID, group.groupID, sourseKeepers[index], index); soundPlayer.interruptible = group.interruptible; soundPlayer.sourseKeeper.sourse.clip = group.GetClip(); soundPlayer.fadeOutTime = group.fadeOutTime; soundPlayer.sourseKeeper.sourse.loop = group.loop; if (group.randomize) { soundPlayer.sourseKeeper.sourse.pitch = 1 + (Random.value - 0.5f) * group.pitchRndValue; soundPlayer.sourseKeeper.SetMultiplier(group.volume * (1 - Random.value * group.volumeRndValue)); } else { soundPlayer.sourseKeeper.sourse.pitch = 1; soundPlayer.sourseKeeper.SetMultiplier(group.volume); } if (group.loop) { soundPlayer.duration = soundPlayer.sourseKeeper.sourse.clip.length / soundPlayer.sourseKeeper.sourse.pitch * group.maxLoopCount; } else { soundPlayer.duration = soundPlayer.sourseKeeper.sourse.clip.length / soundPlayer.sourseKeeper.sourse.pitch; } soundPlayersDictionary.Add(request.ID, soundPlayer); soundPlayer.playCoroutine = StartCoroutine(AwaitStopRoutine(soundPlayer)); soundPlayer.sourseKeeper.sourse.Play(); } return(request); }
public void StartImages() { SoundRequest.RequestMusic("End_Music"); StartCoroutine(ShowObjectives()); StartCoroutine(LoadScene()); }
public virtual void PressButton() { SoundRequest.RequestSound("Button"); }
public void CompleteStep() { SoundRequest.RequestSound("Walk"); }
private void CheckValues() { // Check Good Values for (int i = 0; i < 3; i++) { interactableUI[i].UpdateBox(goodDataValues[i]); if (goodDataValues[i] >= 1.0f) { // this is the winner int ID = goodChosenData[i].ID; InteractableState state = goodChosenData[i].necessaryState; ActionLockFaction(1, 1, goodChosenData[i].tag); goodFactionLocked = true; ActionFlashInteractable(true, goodChosenData[i].icon); ActionAddInteractable(goodChosenData[i].ID, true); // If the chosen interactable does not have a physical location if (ID == 4) { GetComponent <LocateMainObjectiveInteractable>().Execute(); ActionInteractableChosen(RoomManager.instance.GetCurrentRoom().transform.position, true); SoundRequest.RequestSound("Ping"); } else { // Get nearby object with that ID and State AudienceInteractable chosenInteractable = RoomManager.instance.GetInteractableOfType(ID, state); //ActionInteractableChosen if (chosenInteractable != null) { chosenInteractable.Execute(); ActionInteractableChosen(chosenInteractable.transform.position, true); SoundRequest.RequestSound("Ping"); } else { Debug.LogError("No Interactable Possible"); } } TurnOffDisplay(0, i); // Turns off all except for the given display goodDataValues = new float[] { 0.0f, 0.0f, 0.0f }; } } // Check Bad Values for (int i = 0; i < 3; i++) { interactableUI[i + 3].UpdateBox(badDataValues[i]); if (badDataValues[i] >= 1.0f) { if (badDataValues[i] >= 1.0f) { // this is the winner int ID = badChosenData[i].ID; InteractableState state = badChosenData[i].necessaryState; // Get nearby object with that ID and State AudienceInteractable chosenInteractable = RoomManager.instance.GetInteractableOfType(ID, state); ActionLockFaction(0, 1, badChosenData[i].tag); ActionFlashInteractable(false, badChosenData[i].icon); badFactionLocked = true; ActionAddInteractable(badChosenData[i].ID, false); //ActionInteractableChosen if (chosenInteractable != null) { chosenInteractable.Execute(); ActionInteractableChosen(chosenInteractable.transform.position, false); SoundRequest.RequestSound("Ping"); } else { Debug.LogError("No Interactable Possible"); } TurnOffDisplay(1, i); // Turns off all except for the given display badDataValues = new float[] { 0.0f, 0.0f, 0.0f }; } } } }
public SoundRequestBreadBoard(SoundRequest sr) : base(sr.ClipDefinition, sr.GameWorldPositionOfSound) { }
/// <summary> /// 处理消息 /// </summary> public void HandleInformation(string friendName, string informationType, string message) { if (this.InvokeRequired) { this.Invoke(new CbGeneric <string, string, string>(this.HandleInformation), friendName, informationType, message); } else { #region //语音请求 if (int.Parse(informationType) == InformationTypes.SoundRequest) { sendRequestName = friendName; if (listBox1.SelectedItem.ToString() == friendName) { soundRequest = new SoundRequest(userName, friendName, multimediaManager); soundRequest.Show(); soundReming(); return; } else { for (int i = 0; i < listBox1.Items.Count; i++) { if (listBox1.Items[i].ToString().Trim() == friendName) { listBox1.SelectedIndex = i; soundRequest = new SoundRequest(userName, friendName, multimediaManager); soundRequest.Show(); soundReming(); return; } } } } #endregion #region //接受语音 if (int.Parse(informationType) == InformationTypes.SoundReceive) { axWindowsMediaPlayer1.Ctlcontrols.stop();//停止视频语音聊天 sound.ConnectSound(); return; } #endregion #region //拒绝语音 if (int.Parse(informationType) == InformationTypes.SoundReject) { axWindowsMediaPlayer1.Ctlcontrols.stop();//停止视频语音聊天 sound.Close(); if (sound.Disposing || sound.IsDisposed) { richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText("对方拒绝接受语音\n"); toolStripButton3.Enabled = true; return; } richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText("对方拒绝接受语音\n"); toolStripButton3.Enabled = true; return; } #endregion #region 关闭语音 if (int.Parse(informationType) == InformationTypes.CloseSound) { axWindowsMediaPlayer1.Ctlcontrols.stop(); if (sound != null) { if (friendName != sendRequestName) { sound.CloseVideoFunction(int.Parse(informationType), null); richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText(message); toolStripButton3.Enabled = true; return; } else { sound.CloseVideoFunction(-1, null); richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText(message); toolStripButton3.Enabled = true; return; } } else { if (friendName != sendRequestName) { soundRequest.CloseVideoFunction(int.Parse(informationType), null); richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText(message); toolStripButton3.Enabled = true; return; } else { soundRequest.CloseVideoFunction(-1, null); richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText(message); toolStripButton3.Enabled = true; return; } } } #endregion #region //视频请求 if (int.Parse(informationType) == InformationTypes.VideoRequest) { vc = new VideoConnection(userName, friendName, multimediaManager); if (vc.HaveVideo) { return; } if (listBox1.SelectedItem.ToString() == friendName) { vc.OpenVideoViewer(ViewerType.VideoRequest, false); vc.Show(); soundReming(); return; } else { for (int i = 0; i < listBox1.Items.Count; i++) { if (listBox1.Items[i].ToString().Trim() == friendName) { listBox1.SelectedIndex = i; vc.OpenVideoViewer(ViewerType.VideoRequest, false); vc.Show(); soundReming(); return; } } } } #endregion #region 接受视频 if (int.Parse(informationType) == InformationTypes.VideoReceive) { axWindowsMediaPlayer1.Ctlcontrols.stop();//停止视频语音聊天 vc.ConnectVideo(); return; } #endregion #region 拒绝视频 if (int.Parse(informationType) == InformationTypes.VideoReject) { axWindowsMediaPlayer1.Ctlcontrols.stop();//停止视频语音聊天 vc.CloseVideoViewer(); if (vc.Disposing || vc.IsDisposed) { richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText("对方拒绝接受视频\n"); toolStripButton2.Enabled = true; return; } richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText("对方拒绝接受视频\n"); toolStripButton2.Enabled = true; return; } #endregion #region 关闭视频 if (int.Parse(informationType) == InformationTypes.CloseVideo) { if (vc != null) { vc.CloseVideoFunction(-1, null); richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText("对方挂断了视频\n"); toolStripButton2.Enabled = true; axWindowsMediaPlayer1.Ctlcontrols.stop(); } return; } #endregion #region 对方网络中断,关闭视频 if (int.Parse(informationType) == InformationTypes.NetReasonCloseVideo) { vc.CloseVideoFunction(-1, null); richTextBox1.SelectionAlignment = HorizontalAlignment.Center; richTextBox1.AppendText("网络中断,视频终止\n"); toolStripButton2.Enabled = true; axWindowsMediaPlayer1.Ctlcontrols.stop(); return; } #endregion } }