public static int SetVolume_s(IntPtr l) { int result; try { string category; LuaObject.checkType(l, 1, out category); float volume; LuaObject.checkType(l, 2, out volume); bool isSmooth; LuaObject.checkType(l, 3, out isSmooth); AudioUtility.SetVolume(category, volume, isSmooth); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
void OnHit(Vector3 point, Vector3 normal, Collider collider) { // damage if (AreaOfDamage) { // area damage AreaOfDamage.InflictDamageInArea(Damage, point, HittableLayers, k_TriggerInteraction, m_ProjectileBase.Owner); } else { // point damage Damageable damageable = collider.GetComponent <Damageable>(); if (damageable) { damageable.InflictDamage(Damage, false, m_ProjectileBase.Owner); } } // impact vfx if (ImpactVfx) { GameObject impactVfxInstance = Instantiate(ImpactVfx, point + (normal * ImpactVfxSpawnOffset), Quaternion.LookRotation(normal)); if (ImpactVfxLifetime > 0) { Destroy(impactVfxInstance.gameObject, ImpactVfxLifetime); } } // impact sfx if (ImpactSfxClip) { AudioUtility.CreateSFX(ImpactSfxClip, point, AudioUtility.AudioGroups.Impact, 1f, 3f); } // Self Destruct Destroy(this.gameObject); }
private bool ToggleClip() { _isPlaying = !_isPlaying; if (_isPlaying) { if (_currentSample == 0) { AudioUtility.PlayClip(audioClip, 0, _isLooping); } else { ResumeClip(); } } else { _currentSample = AudioUtility.GetClipSamplePosition(audioClip); AudioUtility.PauseClip(audioClip); } return(_isPlaying); }
public static int SearchAndPlaySpineAnimEventSound_s(IntPtr l) { int result; try { string spineDataName; LuaObject.checkType(l, 1, out spineDataName); string animationName; LuaObject.checkType(l, 2, out animationName); string eventName; LuaObject.checkType(l, 3, out eventName); AudioUtility.SearchAndPlaySpineAnimEventSound(spineDataName, animationName, eventName); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
private void OnTriggerEnter(Collider other) { //Debug.Log("Bullet collision: " + other.name, other.gameObject); if (other.CompareTag("Player")) { RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit)) { //Debug.Log("Point of contact: " + hit.point); LeanPool.Spawn(metalImpactEffectPrefab, hit.point, Quaternion.LookRotation(hit.normal, Vector3.up)); } //Debug.Log("Inducing Trauma"); if (useTraumaInducer) { traumaInducer.SendTrauma(); } AudioUtility.PlayRandomClip(LeanPool.Spawn(audioEffect, transform.position, Quaternion.identity).audioSource, metalImpactAudioClips, true); if (UnityEngine.Random.Range(0, 1) == 1) { GameController.s_playerController.damage1(1f); } else { GameController.s_playerController.damage1(2f); } } else if (other.CompareTag("Ground")) { RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit)) { //Debug.Log("Point of contact: " + hit.point); LeanPool.Spawn(dirtImpactEffectPrefab, hit.point, Quaternion.LookRotation(hit.normal, Vector3.up)); } AudioUtility.PlayRandomClip(LeanPool.Spawn(audioEffect, transform.position, Quaternion.identity).audioSource, dirtImpactAudioClips, true); } LeanPool.Despawn(gameObject); }
protected virtual MappedAudioStream MapAudioStream(FFmpegConfig config, AudioStreamInfo sourceStream, AudioOutputStream outputStream) { var result = new MappedAudioStream() { Input = GetStreamInput(sourceStream), Codec = new Codec(GetAudioCodecName(config, outputStream.Format)) }; if (outputStream.Mixdown.HasValue) { result.ChannelCount = AudioUtility.GetChannelCount(outputStream.Mixdown.Value); } if (outputStream.Quality.HasValue) { result.Bitrate = $"{outputStream.Quality:0}k"; } return(result); }
void OnDamaged(float damage, GameObject damageSource) { // test if the damage source is the player if (damageSource && damageSource.GetComponent <PlayerCharacterController>()) { // pursue the player m_DetectionModule.OnDamaged(damageSource); if (onDamaged != null) { onDamaged.Invoke(); } m_LastTimeDamaged = Time.time; // play the damage tick sound if (damageTick && !m_WasDamagedThisFrame) { AudioUtility.CreateSFX(damageTick, transform.position, AudioUtility.AudioGroups.DamageTick, 0f); } m_WasDamagedThisFrame = true; } }
// Token: 0x0600E355 RID: 58197 RVA: 0x003D2850 File Offset: 0x003D0A50 private void OnSkillToggleValueChanged(bool isOn) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_OnSkillToggleValueChangedBoolean_hotfix != null) { this.m_OnSkillToggleValueChangedBoolean_hotfix.call(new object[] { this, isOn }); return; } BJLuaObjHelper.IsSkipLuaHotfix = false; this.ShowSelectImage(isOn); if (isOn) { if (!this.m_hasUnLocked) { Hero hero = this.m_playerContext.GetHero(this.m_heroId); this.m_hasUnLocked = hero.Fetters.ContainsKey(this.HeroFetterInfo.ID); } if (this.m_hasUnLocked) { AudioUtility.PlaySound("UI_LargeIconClick"); } else if (this.m_playerContext.CanUnlockHeroFetter(this.m_heroId, this.HeroFetterInfo.ID) == 0) { AudioUtility.PlaySound("UI_ReadytoUnlock"); } else { AudioUtility.PlaySound("UI_CantUnlock"); } if (this.EventOnClick != null) { this.EventOnClick(this); } } }
void EndGame(bool win) { // unlocks the cursor before leaving the scene, to be able to click buttons Cursor.lockState = CursorLockMode.None; Cursor.visible = true; m_TimeManager.StopRace(); configuration.rankPlayer = FindRankIndex(playerKart) + 1; // Remember that we need to load the appropriate end scene after a delay gameState = win ? GameState.Won : GameState.Lost; endGameFadeCanvasGroup.gameObject.SetActive(true); if (win) { m_SceneToLoad = winSceneName; m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay + delayBeforeFadeToBlack; // play a sound on win var audioSource = gameObject.AddComponent <AudioSource>(); audioSource.clip = victorySound; audioSource.playOnAwake = false; audioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.HUDVictory); audioSource.PlayScheduled(AudioSettings.dspTime + delayBeforeWinMessage); // create a game message winDisplayMessage.delayBeforeShowing = delayBeforeWinMessage; winDisplayMessage.gameObject.SetActive(true); } else { playerKart.SetCanMove(false); m_SceneToLoad = loseSceneName; m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay + delayBeforeFadeToBlack; // create a game message loseDisplayMessage.delayBeforeShowing = delayBeforeWinMessage; loseDisplayMessage.gameObject.SetActive(true); } }
void Start() { if (autoFindKarts) { karts = FindObjectsOfType <ArcadeKart>(); if (karts.Length > 0) { if (!playerKart) { playerKart = karts[0]; } } DebugUtility.HandleErrorIfNullFindObject <ArcadeKart, GameFlowManager>(playerKart, this); } m_ObjectiveManager = FindObjectOfType <ObjectiveManager>(); DebugUtility.HandleErrorIfNullFindObject <ObjectiveManager, GameFlowManager>(m_ObjectiveManager, this); m_TimeManager = FindObjectOfType <TimeManager>(); DebugUtility.HandleErrorIfNullFindObject <TimeManager, GameFlowManager>(m_TimeManager, this); AudioUtility.SetMasterVolume(1); winDisplayMessage.gameObject.SetActive(false); loseDisplayMessage.gameObject.SetActive(false); m_TimeManager.StopRace(); foreach (ArcadeKart k in karts) { k.SetCanMove(false); } //run race countdown animation ShowRaceCountdownAnimation(); StartCoroutine(ShowObjectivesRoutine()); StartCoroutine(CountdownThenStartRaceRoutine()); }
void EndGame(bool win) { mainAudio.Stop(); Debug.Log("EndGame"); Cursor.lockState = CursorLockMode.None; Cursor.visible = true; m_TimeManager.StopRace(); //Remember that we need to load the appropriate end scene after a delay gameState = win ? GameState.Won : GameState.Lost; endGameFadeCanvasGroup.gameObject.SetActive(true); if (win) //이겼을 때 { m_SceneToLoad = winSceneName; m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay + delayBeforeFadeToBlack; //씬 딜레이 시간 // play a sound on win // play a sound on win var audioSource = gameObject.AddComponent <AudioSource>(); audioSource.clip = victorySound; audioSource.playOnAwake = false; audioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.HUDVictory); audioSource.PlayScheduled(AudioSettings.dspTime + delayBeforeWinMessage); // create a game message winDisplayMessage.delayBeforeShowing = delayBeforeWinMessage; winDisplayMessage.gameObject.SetActive(true); //이겼다는 메세지 true } else { m_SceneToLoad = loseSceneName; m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay + delayBeforeFadeToBlack; var deFeataudioSource = gameObject.AddComponent <AudioSource>(); deFeataudioSource.clip = defeatSound; deFeataudioSource.playOnAwake = false; deFeataudioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.HUDVictory); deFeataudioSource.PlayScheduled(AudioSettings.dspTime + delayBeforeWinMessage); // create a game message loseDisplayMessage.delayBeforeShowing = delayBeforeWinMessage; loseDisplayMessage.gameObject.SetActive(true); } }
void Start() { // roseControls = new RoseInputSettings(); // var bindingGroup = roseControls.controlSchemes.First(x => x.name == "Gamepad").bindingGroup; // // Spawn players with specific devices. // var p1 = PlayerInput.Instantiate(playerPrefab, controlScheme: "Gamepad", pairWithDevice: Gamepad.all[0]); // var p2 = PlayerInput.Instantiate(playerPrefab, controlScheme: "PC_KBM", pairWithDevice: Keyboard.current); // p1.user.UnpairDevice(Keyboard.current); // p1.user.UnpairDevice(Mouse.current); // p2.user.UnpairDevice(Gamepad.all[0]); // p1.user.actions.bindingMask = InputBinding.MaskByGroup(bindingGroup); m_ObjectiveManager = GetComponent <ObjectiveManager>(); // DebugUtility.HandleErrorIfNullFindObject<ObjectiveManager, GameFlowManager>(m_ObjectiveManager, this); AudioUtility.SetMasterVolume(1); FindPlayers(); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
void OnDamaged(float damage, GameObject damageSource) { //損傷の原因がプレイヤーかどうかをテストします if (damageSource && damageSource.GetComponent <PlayerCharacterController>()) { //プレーヤーを追跡します m_DetectionModule.OnDamaged(damageSource); if (onDamaged != null) { onDamaged.Invoke(); } m_LastTimeDamaged = Time.time; //ダメージティックサウンドを再生します if (damageTick && !m_WasDamagedThisFrame) { AudioUtility.CreateSFX(damageTick, transform.position, AudioUtility.AudioGroups.DamageTick, 0f); } m_WasDamagedThisFrame = true; } }
void OnDamaged(float damage, GameObject damageSource) { // test if the damage source is the player //测试伤害源是否是玩家 if (damageSource && !damageSource.GetComponent <EnemyController>()) { // pursue the player //追击玩家 DetectionModule.OnDamaged(damageSource); onDamaged?.Invoke(); m_LastTimeDamaged = Time.time; // play the damage tick sound //播放伤害滴答声 if (DamageTick && !m_WasDamagedThisFrame) { AudioUtility.CreateSFX(DamageTick, transform.position, AudioUtility.AudioGroups.DamageTick, 0f); } m_WasDamagedThisFrame = true; } }
void Start() { //spawn duration will last 30 frames _spawnDuration = 30f * Time.fixedDeltaTime; //death duration will last 10 frames _deathDuration = 10f * Time.fixedDeltaTime; _maxForce = _maxVelocity / 3 * _rigidbody.mass / Time.fixedDeltaTime; _deltaThetaLook = _deltaTheta * 2f; gameObject.transform.Translate(initialPosition); _playerTransform = GameObject.FindWithTag("Player").transform.Find("Main Camera"); _enemyAnimator.Stop(); _enemyAnimator.Play("SwarmerSpawn"); if (_spawnClip) { AudioUtility.CreateSFX(_spawnClip, transform.position, AudioUtility.AudioGroups.EnemySpawn, 0.6f, 30f, 500f, 0.4f); } }
private void Update() { if (_isPlaying) { if (AudioUtility.IsClipPlaying(audioClip)) { if (_timeSinceRepaint > 1 / _timnelineRepaintFrequency) { _currentSample = AudioUtility.GetClipSamplePosition(audioClip); Repaint(); _timeSinceRepaint = 0; } else { _timeSinceRepaint += Time.deltaTime; } } else { StopClip(); } } }
void EndGame(bool win) { saveHandler.OnSave(); // unlocks the cursor before leaving the scene, to be able to click buttons Cursor.lockState = CursorLockMode.None; Cursor.visible = true; // Remember that we need to load the appropriate end scene after a delay gameIsEnding = true; endGameFadeCanvasGroup.gameObject.SetActive(true); if (win) { m_SceneToLoad = winSceneName; m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay + delayBeforeFadeToBlack; // play a sound on win var audioSource = gameObject.AddComponent <AudioSource>(); audioSource.clip = victorySound; audioSource.playOnAwake = false; audioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.HUDVictory); audioSource.PlayScheduled(AudioSettings.dspTime + delayBeforeWinMessage); // create a game message var message = Instantiate(WinGameMessagePrefab).GetComponent <DisplayMessage>(); if (message) { message.delayBeforeShowing = delayBeforeWinMessage; message.GetComponent <Transform>().SetAsLastSibling(); } } else { m_SceneToLoad = loseSceneName; m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay; } }
public override void OnInteractivePreviewGUI(Rect r, GUIStyle background) { if (lsdTarget.length == 0) { lsdTarget.length = lsdTarget.clip.length; } if (lsdTarget.clip != null) { AudioUtility.DrawWaveForm(lsdTarget.clip, 0, new Rect(0, r.y + 3, EditorGUIUtility.currentViewWidth, r.height)); } //Playhead if (Event.current.button != 1) { seekPosition = GUI.HorizontalSlider(new Rect(0, r.y + 3, EditorGUIUtility.currentViewWidth, r.height), seekPosition, 0, 1, GUIStyle.none, GUIStyle.none); } GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 3, r.y, 7, r.height), playhead_line); GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 7, r.y, 15, 15), playhead_top); GUI.DrawTexture(new Rect((seekPosition * EditorGUIUtility.currentViewWidth) - 7, r.y + r.height - 16, 15, 15), playhead_bottom); if (Event.current.type == EventType.Repaint) { LipSyncEditorExtensions.DrawTimeline(r.y, 0, lsdTarget.length, r.width); } if (visualPreview && previewTarget != null) { EditorGUI.HelpBox(new Rect(20, r.y + r.height - 45, r.width - 40, 25), "Preview mode active. Note: only Phonemes and Emotions will be shown in the preview.", MessageType.Info); } else if (previewTarget != null) { UpdatePreview(0); previewTarget = null; } }
void Update() { //if (NetworkManager.GetComponent<Mirror.NetworkManagerCar>().numPlayers != 1) return; if (gameState != GameState.Play) { elapsedTimeBeforeEndScene += Time.deltaTime; if (elapsedTimeBeforeEndScene >= endSceneLoadDelay) { float timeRatio = 1 - (m_TimeLoadEndGameScene - Time.time) / endSceneLoadDelay; endGameFadeCanvasGroup.alpha = timeRatio; float volumeRatio = Mathf.Abs(timeRatio); float volume = Mathf.Clamp(1 - volumeRatio, 0, 1); AudioUtility.SetMasterVolume(volume); // See if it's time to load the end scene (after the delay) if (Time.time >= m_TimeLoadEndGameScene) { SceneManager.LoadScene(m_SceneToLoad); gameState = GameState.Play; } } } else { if (m_ObjectiveManager.AreAllObjectivesCompleted()) { EndGame(true); } if (m_TimeManager.IsFinite && m_TimeManager.IsOver) { EndGame(false); } } }
private void HandleWin(Hashtable arg0) { Timer.timerIsRunning = false; // unlocks the cursor before leaving the scene, to be able to click buttons Cursor.lockState = CursorLockMode.None; Cursor.visible = true; // Remember that we need to load the appropriate end scene after a delay gameIsEnding = true; endGameFadeCanvasGroup.gameObject.SetActive(true); Debug.Log("WIN GAME"); m_SceneToLoad = winSceneName; m_TimeLoadEndGameScene = Time.time + endSceneLoadDelay + delayBeforeFadeToBlack; // play a sound on win var audioSource = gameObject.AddComponent <AudioSource>(); audioSource.clip = victorySound; audioSource.playOnAwake = false; audioSource.outputAudioMixerGroup = AudioUtility.GetAudioGroup(AudioUtility.AudioGroups.HUDVictory); audioSource.PlayScheduled(AudioSettings.dspTime + delayBeforeWinMessage); }
private void DrawKeyframeMenu() { GUILayout.BeginHorizontal(); if (GUILayout.Button("Add keyframe") && this.m_IsPlayingReview == false) { var nodeTimelineIndex = (int)this.m_SoundTimeLine; var keyName = "Keyframe_" + nodeTimelineIndex; // Create new node var nodeData = CreateNewNode(nodeTimelineIndex); if (this.m_DictNodeData.ContainsKey(keyName)) { // Add new key node in key frame this.m_DictNodeData [keyName].Add(nodeData); } else { // Create new key frame this.m_DictNodeData.Add(keyName, new List <CNodeEditorData> ()); // Add new key node in key frame this.m_DictNodeData [keyName].Add(nodeData); } var listNode = this.m_DictNodeData [keyName]; nodeData.editorIndex = listNode.Count - 1; this.m_CurrentSelectKeyframe = keyName; } if (GUILayout.Button("Delete keyframe") && this.m_IsPlayingReview == false) { if (string.IsNullOrEmpty(this.m_CurrentSelectKeyframe) == false) { if (this.m_DictNodeData.ContainsKey(this.m_CurrentSelectKeyframe)) { this.m_DictNodeData [this.m_CurrentSelectKeyframe].Clear(); this.m_DictNodeData.Remove(this.m_CurrentSelectKeyframe); this.m_CurrentSelectKeyframe = string.Empty; this.m_CurrentSelectedNode = null; } } } if (GUILayout.Button("Copy keyframe")) { if (string.IsNullOrEmpty(this.m_CurrentSelectKeyframe) == false) { if (this.m_DictNodeData.ContainsKey(this.m_CurrentSelectKeyframe)) { var keyframes = this.m_DictNodeData [this.m_CurrentSelectKeyframe]; this.m_CurrentTargetKeyframe = keyframes; } } } if (GUILayout.Button("Paste keyframe")) { if (this.m_CurrentTargetKeyframe != null && this.m_CurrentTargetKeyframe.Count > 0) { var nodeTimelineIndex = (int)this.m_SoundTimeLine; var keyName = "Keyframe_" + nodeTimelineIndex; if (this.m_DictNodeData.ContainsKey(keyName)) { // TODO } else { // Create new key frame this.m_DictNodeData.Add(keyName, new List <CNodeEditorData> ()); } for (int i = 0; i < this.m_CurrentTargetKeyframe.Count; i++) { var tmpNode = this.m_CurrentTargetKeyframe [i]; var newNode = new CNodeEditorData(); newNode.audioTime = nodeTimelineIndex; newNode.nodeType = tmpNode.nodeType; newNode.nodePosition = tmpNode.nodePosition; newNode.nodeScale = tmpNode.nodeScale; this.m_DictNodeData [keyName].Add(newNode); newNode.editorIndex = this.m_DictNodeData [keyName].Count - 1; newNode.editorNodePosition = newNode.nodePosition.ToVector2(); } this.m_CurrentSelectKeyframe = keyName; } } GUILayout.FlexibleSpace(); if (GUILayout.Button(this.m_IsPlayingReview == false ? "Play review" : "Stop review")) { this.m_CurrentSelectKeyframe = string.Empty; this.m_CurrentSelectedNode = null; this.m_IsPlaying = false; this.m_IsPause = false; this.m_IsPlayingReview = !this.m_IsPlayingReview; this.m_IsPauseReview = false; if (this.m_IsPlayingReview) { AudioUtility.StopAllClips(); AudioUtility.PlayClip(this.m_SoundAudio); } else { AudioUtility.StopClip(this.m_SoundAudio); } } if (GUILayout.Button(this.m_IsPauseReview == false ? "Pause review" : "Resume review") && this.m_IsPlayingReview) { this.m_IsPauseReview = !this.m_IsPauseReview; if (this.m_IsPauseReview) { AudioUtility.PauseClip(this.m_SoundAudio); } else { AudioUtility.ResumeClip(this.m_SoundAudio); } } GUILayout.EndHorizontal(); }
private static void Stop(SerializedProperty prop, AudioClip clip) { CurrentClip = ""; AudioUtility.StopClip(clip); }
private void DrawButton(Rect position, SerializedProperty prop) { if (prop.objectReferenceValue != null) { position.x -= 4; AudioClip clip = prop.objectReferenceValue as AudioClip; Rect buttonRect = new Rect(position); buttonRect.width = 20; Rect waveformRect = new Rect(position); waveformRect.x += 22; waveformRect.width -= 22; Texture2D waveformTexture = AssetPreview.GetAssetPreview(prop.objectReferenceValue); if (waveformTexture != null) { GUI.DrawTexture(waveformRect, waveformTexture); } bool isPlaying = AudioUtility.IsClipPlaying(clip) && (CurrentClip == prop.propertyPath); string buttonText = ""; Action <SerializedProperty, AudioClip> buttonAction; if (isPlaying) { EditorUtility.SetDirty(prop.serializedObject.targetObject); buttonAction = GetStateInfo(ButtonState.Stop, out buttonText); Rect progressRect = new Rect(waveformRect); float percentage = (float)AudioUtility.GetClipSamplePosition(clip) / AudioUtility.GetSampleCount(clip); float width = progressRect.width * percentage; progressRect.width = Mathf.Clamp(width, 6, width); GUI.Box(progressRect, "", "SelectionRect"); } else { buttonAction = GetStateInfo(ButtonState.Play, out buttonText); } if (GUI.Button(buttonRect, buttonText)) { AudioUtility.StopAllClips(); buttonAction(prop, clip); } } }
// Use this for initialization void Start() { AudioUtility.PlaySound(atts[0]); // Debug.Log( Resources.Load<Preofds>("Audio/Preofds_1").atts.Count); }
void Update() { VelocityUpdate(); //booster if (Input.GetKey(KeyCode.UpArrow) && !isBoost && map1BoostCanStart) { boosterBar.value += 0.1f; } if (boosterBar.value == 50.0f && !isBoost) { Debug.Log("booster bar full!"); addBooster(); boosterBar.value = 0.0f; } if (Input.GetKey(KeyCode.LeftControl)) { if (!isBoost && boosterNum > 0.0f) { boostTime = Time.time; isBoost = true; deleteBooster(); } } if (isBoost) { if (Time.time - boostTime > 3f) { isBoost = false; boosterBar.value = 0.0f; boosterState.enabled = false; } else { boosterBar.value = 50.0f; boosterState.enabled = true; } } //drift if (Input.GetKey(KeyCode.LeftShift)) { if (!isDrift) { isDrift = true; driftTime = Time.time; } } else { isDrift = false; } if (gameState != GameState.Play) { elapsedTimeBeforeEndScene += Time.deltaTime; if (elapsedTimeBeforeEndScene >= endSceneLoadDelay) { float timeRatio = 1 - (m_TimeLoadEndGameScene - Time.time) / endSceneLoadDelay; endGameFadeCanvasGroup.alpha = timeRatio; float volumeRatio = Mathf.Abs(timeRatio); float volume = Mathf.Clamp(1 - volumeRatio, 0, 1); AudioUtility.SetMasterVolume(volume); // See if it's time to load the end scene (after the delay) if (Time.time >= m_TimeLoadEndGameScene) { SceneManager.LoadScene(m_SceneToLoad); gameState = GameState.Play; } } } else { if (KeyboardInput.isFinish & KartCollisionManager.checkWinner)//모든 것을 다 통과하고 + 시간 내이며 // gameobject가 finish 선 밟았을 때 { if (KartCollisionManager.localPlayerIsWinner) { EndGame(true); //이겼을 때 } else { EndGame(false); } } //if (m_TimeManager.IsFinite && m_TimeManager.IsOver) //{ // EndGame(false); //졌을 때 // Debug.Log("EndGame(false)"); //} } //item 처리 if (KartCollisionManager.updateItemBox) { changeImage(KartCollisionManager.localPlayerItemStates); } //cloud 처리 if (KartCollisionManager.localPlayerCloudEffect) { mm_audio.clip = GetCloud; mm_audio.Play(); Debug.Log("Local player cloud effect start"); if (Time.time - KartCollisionManager.localPlayerCloudEffectTime < 5.0f) { cloudItem.enabled = true; } else { cloudItem.enabled = false; KartCollisionManager.localPlayerCloudEffect = false; } } //rocket 조준 처리 if (KartCollisionManager.localPlayerUseRocket) { activeRocketBar(); } //nameList Update if (PhotonNetwork.IsMasterClient) { string resultText = ""; ArcadeKart[] currentKarts; currentKarts = FindObjectsOfType <ArcadeKart>(); List <Tuple <int, string> > rankingDict = new List <Tuple <int, string> >(); List <int> keyList = new List <int>(); foreach (ArcadeKart kart in currentKarts) { rankingDict.Add(new Tuple <int, string>(kart.currentCheckpointIndex, kart.nameText)); keyList.Add(kart.currentCheckpointIndex); } keyList.Sort(); keyList.Reverse(); foreach (var key in keyList) { foreach (var ranking in rankingDict) { if (ranking.Item1 == key) { resultText += ranking.Item2; rankingDict.Remove(ranking); break; } } resultText += "\n"; } photonView.RPC("updateNameList", RpcTarget.All, resultText); } //ranking update if (localPlayerPassCheckpoint) { ArcadeKart.localPlayerPassCheckpointIndex = CheckPointManager.currentCheckpointIndex; ArcadeKart.updateCheckpoint = true; localPlayerPassCheckpoint = false; } }
public void PlaySfxWithRandomization() { AudioUtility.PlayOneShotWithRandomization(audioSource, sfx, minVol, maxVol, minPitch, maxPitch); }
void Start() { //sapwPlayer(); AudioUtility.SetMasterVolume(1); }
private void OnDestroy() { AudioUtility.StopAllClips(); }
public override void OnInspectorGUI() { currentWidth = EditorGUIUtility.currentViewWidth; EditorGUILayout.Space(); EditorGUILayout.LabelField("【Volume】"); EditorGUILayout.Slider(m_volumeTotalProp, 0.0f, 1.0f, "Total"); EditorGUILayout.Slider(m_volumeSeProp, 0.0f, 1.0f, "SE"); EditorGUILayout.Slider(m_volumeBgmProp, 0.0f, 1.0f, "BGM"); EditorGUILayout.Space(); EditorGUILayout.LabelField("【AudioMixerGroup】"); EditorGUILayout.PropertyField(m_seAudioMixerGroupProp); EditorGUILayout.PropertyField(m_bgmAudioMixerGroupProp); EditorGUILayout.Space(); EditorGUILayout.LabelField("【Other】"); EditorGUILayout.PropertyField(m_isChangeToSaveProp); EditorGUILayout.PropertyField(m_isChangeSceneToStopSeProp); m_sePlayerNumProp.intValue = EditorGUILayout.IntField("SE PlayerCount", m_sePlayerNumProp.intValue); EditorGUILayout.Space(); EditorGUILayout.LabelField("【SoundList】"); m_editorIsFoldSeListProp.boolValue = EditorGUILayout.Foldout(m_editorIsFoldSeListProp.boolValue, " SE", true); if (!m_editorIsFoldSeListProp.boolValue) { EditorGUILayout.BeginVertical(GUI.skin.box); if (m_audioClipListSeProp.arraySize == 0) { EditorGUILayout.LabelField("None"); } else { for (int i = 0; i < m_audioClipListSeProp.arraySize; i++) { var p = m_audioClipListSeProp.GetArrayElementAtIndex(i); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField((i + 1).ToString("00") + ".", GUILayout.Width(20)); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField(p.objectReferenceValue, typeof(AudioClip), false); EditorGUI.EndDisabledGroup(); var clip = (AudioClip)p.objectReferenceValue; var timeSpan = System.TimeSpan.FromSeconds(clip.length); EditorGUILayout.LabelField(timeSpan.Minutes.ToString("00") + ":" + timeSpan.Seconds.ToString("00"), GUILayout.Width(40)); //Editor上で再生できる様に修正 if (GUILayout.Button("Play")) { AudioUtility.StopAllClips(); AudioUtility.PlayClip((AudioClip)p.objectReferenceValue); } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndVertical(); } m_editorIsFoldBgmListProp.boolValue = EditorGUILayout.Foldout(m_editorIsFoldBgmListProp.boolValue, " BGM", true); if (!m_editorIsFoldBgmListProp.boolValue) { EditorGUILayout.BeginVertical(GUI.skin.box); if (m_audioClipListBgmProp.arraySize == 0) { EditorGUILayout.LabelField("None"); } else { for (int i = 0; i < m_audioClipListBgmProp.arraySize; i++) { var p = m_audioClipListBgmProp.GetArrayElementAtIndex(i); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField((i + 1).ToString("00") + ".", GUILayout.Width(20)); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField(p.objectReferenceValue, typeof(AudioClip), false); EditorGUI.EndDisabledGroup(); var clip = (AudioClip)p.objectReferenceValue; var timeSpan = System.TimeSpan.FromSeconds(clip.length); EditorGUILayout.LabelField(timeSpan.Minutes.ToString("00") + ":" + timeSpan.Seconds.ToString("00"), GUILayout.Width(40)); //Editor上で再生できる様に修正 if (GUILayout.Button("Play")) { AudioUtility.StopAllClips(); AudioUtility.PlayClip((AudioClip)p.objectReferenceValue); } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndVertical(); } EditorUtility.SetDirty(target); m_serializedObj.ApplyModifiedProperties(); }
protected override void OnExecute() { AudioUtility.PlayClipAtPoint(_Clip, _Position.value, _Volume, _OutputAudioMixerGroup, _SpatialBlend); FinishExecute(true); }