void Update() { animator.SetFloat("Speed", nvAgent.velocity.magnitude); //Footstep sound if (!GameData.isPaused && nvAgent.velocity.magnitude > 1f && !audioSrc.isPlaying) { audioSrc.PlayOneShot(SoundDatabase.GetRandomFootstep()); } //Clicks if (!GameData.isInMenu) { if (Input.touchCount == 1) { Touch touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began) { ClickOnPosition(touch.position); return; } } if (GameData.gameMode == GameData.Mode.Free) { if (Input.GetKeyDown(KeyCode.Mouse0)) { ClickOnPosition(Input.mousePosition); } } } }
private void RegisterBankAsCallback(SoundProfile profile, SoundDatabase soundDatabase) { if (profile != null && soundDatabase != null) { soundDatabase.Create(profile); this.resourceLoadingCounter--; if (this.resourceLoadingCounter == 0) { this.activeCallback(soundDatabase, false); } else { SoundLib.Log("resourceLoadingCounter > 0! resourceLoadingCounter: " + this.resourceLoadingCounter); this.activeCallback(soundDatabase, true); } } else { SoundLib.Log("either profile OR soundDatabase is null"); this.resourceLoadingCounter--; if (this.resourceLoadingCounter == 0) { this.activeCallback(soundDatabase, true); } else { SoundLib.Log("resourceLoadingCounter > 0! resourceLoadingCounter: " + this.resourceLoadingCounter); this.activeCallback(soundDatabase, true); } } }
private void StartRenameSoundDatabase(SoundDatabase soundDatabaseBeingRenamed) { ResetCreateNewSoundDatabase(); ResetSearchSoundyDatabase(); m_soundDatabaseBeingRenamed = soundDatabaseBeingRenamed; m_newSoundDatabaseName = soundDatabaseBeingRenamed.DatabaseName; }
public void StopSoundEffect(Int32 soundIndex) { SoundDatabase[] array = new SoundDatabase[] { this.gameSoundDatabase, this.sceneSoundDatabase, this.onTheFlySoundDatabase }; SoundDatabase[] array2 = array; for (Int32 i = 0; i < (Int32)array2.Length; i++) { SoundDatabase soundDatabase = array2[i]; foreach (KeyValuePair <Int32, SoundProfile> keyValuePair in soundDatabase.ReadAll()) { SoundProfile value = keyValuePair.Value; if (value.SoundIndex == soundIndex) { Int32 soundID = value.SoundID; if (this.playedEffectSet.Contains(soundID)) { ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_Stop(soundID, 0); this.playedEffectSet.Remove(soundID); SoundLib.Log("Force stop success"); } else { SoundLib.Log("soundID: " + soundID + " not found"); } } } } }
public void CorrectAnswer() { Countdown.Instance.StopCountdown(); UI_Manager.Instance.OpenMenu(GameData.QuestionAnsweredScreen); GameData.QuestionAnsweredImage.color = Color.green; GameData.QuestionAnsweredText.text = GameData.ActiveLanguage.fishing_correct_answer.Replace("<br>", "\n"); SoundDatabase.PlayWinSound(); var randomFish = GameData.FishDatabase.items[Random.Range(0, GameData.FishDatabase.items.Count)]; var sameFishInInventory = Player.Inventory.Where(x => x.data.ID == randomFish.data.ID); if (sameFishInInventory.Count() > 0) { sameFishInInventory.ElementAt(0).data.amount++; } else { var fish = Instantiate(randomFish, Player.Instance.inventoryParent); fish.Activate(); Player.Inventory.Add(fish); } int amount = Random.Range(1, Player.Rod.data.fishMultiplier); Notification.Instance.Display(string.Format(GameData.ActiveLanguage.fishing_caught_fish, amount, randomFish.name), randomFish.icon, 2f, Notification.NotificationType.GoodNews); }
void AddCurrentOptionIndex(int amount) { LeavingCurrentOption(); CurrentOptionIndex += amount; PointAtCurrentOption(); SoundDatabase.PlaySound(34); }
public void EquipArmor(Item itemToEquip) { SoundDatabase.PlaySound(0); foreach (Transform item in playerArmor.transform) { Item checkItem = item.GetComponent <ItemHolder>().item; if (checkItem.ItemType == itemToEquip.ItemType) { UnequipArmor(checkItem); Destroy(item.gameObject); } } Armor armor = Instantiate(Resources.Load <Armor>("Prefabs/Items/" + itemToEquip.Name)); armor.transform.SetParent(playerArmor.transform); armor.transform.localScale = new Vector3(1, 1, 1); //GameObject armor = new GameObject(); //armor.AddComponent<ItemHolder>(); //armor.GetComponent<ItemHolder>().item = itemToEquip; //armor.AddComponent<SpriteRenderer>(); //armor.GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>("Icons/PlayerEquips/" + itemToEquip.Name); //armor.GetComponent<SpriteRenderer>().sortingOrder = 10; armor.name = itemToEquip.Name; //armor.transform.SetParent(playerArmor.transform); armor.transform.localPosition = new Vector3(0, 0, 0); //armor.transform.localScale = new Vector3(1, 1, 1); // itemToEquip.Stats.AddStatsToOther(player.Stats); //equippedWeapon = EquippedWeapon.GetComponent<IArmor>(); //itemToEquip.Stats = itemToEquip.Stats; UIEventHandler.ItemEquipped(itemToEquip); UIEventHandler.StatsChanged(); }
protected override void OnDisable() { DestroyImmediate(m_previewAudioSource.gameObject); if (Data == null) { return; } if (!Data.name.Equals(GetProperty(PropertyName.SoundName).stringValue)) { Data.name = GetProperty(PropertyName.SoundName).stringValue; m_needsSave = true; } if (m_soundNameHasBeenChanged) { SoundDatabase soundDatabase = SoundySettings.Database.GetSoundDatabase(GetProperty(PropertyName.DatabaseName).stringValue); if (soundDatabase != null && m_soundNameHasBeenChanged) { soundDatabase.UpdateSoundNames(false); } } if (m_needsSave) { Data.SetDirty(false); } if (!m_needsSave && !m_soundNameHasBeenChanged) { return; } AssetDatabase.SaveAssets(); }
public void Decline() { SoundDatabase.PlaySound(21); Destroy(gameObject); DialogueSystem.Instance.ShowQuest = false; DialogueSystem.Instance.MakeDialouge(CurrentQuest.DeclineText); }
public void SetVolume(Single volume) { SoundDatabase[] array = new SoundDatabase[] { this.gameSoundDatabase, this.sceneSoundDatabase, this.onTheFlySoundDatabase }; SoundDatabase[] array2 = array; for (Int32 i = 0; i < (Int32)array2.Length; i++) { SoundDatabase soundDatabase = array2[i]; foreach (KeyValuePair <Int32, SoundProfile> keyValuePair in soundDatabase.ReadAll()) { SoundProfile value = keyValuePair.Value; Int32 soundID = value.SoundID; if (this.playedEffectSet.Contains(soundID)) { ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetVolume(soundID, volume, 0); SoundLib.Log("Set volume to soundID: " + soundID + " finished"); } else { SoundLib.Log("soundID: " + soundID + " not found"); } } } this.playerVolume = volume; }
public void SetAsExitOption() { optionText.text = "Close"; optionButton.onClick.AddListener(() => DialogueSystem.Instance.dialoguePanel.SetActive(false)); optionButton.onClick.AddListener(() => PlayerMovement.cantMove = false); optionButton.onClick.AddListener(() => SoundDatabase.PlaySound(21)); }
public override void Load(SoundProfile profile, ResultCallback callback, SoundDatabase soundDatabase) { try { IntPtr akbData = ReadAkbDataToUnmanagedMemory(profile); if (akbData == IntPtr.Zero) { _resourceLoader.Load(profile, callback, soundDatabase); return; } try { Int32 bankID = ISdLibAPIProxy.Instance.SdSoundSystem_AddData(akbData); profile.AkbBin = akbData; profile.BankID = bankID; } catch { Marshal.FreeHGlobal(akbData); throw; } callback(profile, soundDatabase); } catch (Exception ex) { Log.Error(ex, "Failed to import sound: " + profile.ResourceID); _resourceLoader.Load(profile, callback, soundDatabase); } }
public Boolean IsSoundEffectPlaying(Int32 soundIndex) { SoundDatabase[] array = new SoundDatabase[] { this.gameSoundDatabase, this.sceneSoundDatabase, this.onTheFlySoundDatabase }; SoundDatabase[] array2 = array; for (Int32 i = 0; i < (Int32)array2.Length; i++) { SoundDatabase soundDatabase = array2[i]; foreach (KeyValuePair <Int32, SoundProfile> keyValuePair in soundDatabase.ReadAll()) { SoundProfile value = keyValuePair.Value; if (value.SoundIndex == soundIndex) { Int32 soundID = value.SoundID; if (this.playedEffectSet.Contains(soundID)) { return(true); } SoundLib.Log("soundID: " + soundID + " not found"); } } } SoundLib.Log("soundIndex: " + soundIndex + " not found in DB"); return(false); }
// USED IN PlayerActivesController // ALL ACTIVES GO HERE public static void GetSkillActiveEffect(int id) { switch (id) { case 1: { SkillEvents.OnSkillUse += Meditate; SoundDatabase.PlaySound(10); break; } case 2: { Player.OnTakeDamage += ManaGaurd; SoundDatabase.PlaySound(19); break; } } }
public void Accept() { SoundDatabase.PlaySound(9); Destroy(gameObject); DialogueSystem.Instance.MakeDialouge(CurrentQuest.AcceptText); DialogueSystem.Instance.ShowQuest = false; UIEventHandler.QuestAccepted(CurrentQuest); EventNotifier.Instance.MakeEventNotifier(string.Format("Quest Accepted: {0}", CurrentQuest.Name)); }
public void CreateIntro() { SoundDatabase.PlayMusic(10); Transform intro = Instantiate(Resources.Load <Transform>("Prefabs/Intro"), canvas.transform); intro.localScale = new Vector3(1, 1, 1); intro.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0); intro.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0); }
public void completedButtonClick() { if (showingInprogressScroll) { SoundDatabase.PlaySound(18); completedScroll.SetActive(true); inProgressScroll.SetActive(false); showingInprogressScroll = !showingInprogressScroll; } }
public void HotkeyAssignPress(Transform self) { SoundDatabase.PlaySound(32); int selfIndex = self.GetSiblingIndex(); PanelSkill panelSkill = hotSkillPanel.transform.GetChild(selfIndex).GetComponent <PanelSkill>(); panelSkill.playerSkill = currentSkill; panelSkill.UpdateImage(); hotkeyAssign.SetActive(!hotkeyAssign.activeInHierarchy); }
public void UnequipArmor(Item item) { SoundDatabase.PlaySound(0); item.Stats.RemoveStatsFromOther(player.Stats); inventoryController.GiveItem(item); Destroy(playerArmor.transform.Find(item.Name).gameObject); UIEventHandler.ItemUnequipped(item); UIEventHandler.StatsChanged(); SoundDatabase.PlaySound(0); }
public void HotKeyDeletePress(Transform self) { SoundDatabase.PlaySound(21); int selfIndex = self.GetSiblingIndex(); PanelSkill panelSkill = hotSkillPanel.transform.GetChild(selfIndex).GetComponent <PanelSkill>(); panelSkill.cooldownCircle.fillAmount = 0; panelSkill.playerSkill = null; panelSkill.UpdateImage(); }
protected void UnloadResource(SoundDatabase soundDatabase) { Dictionary <Int32, SoundProfile> dictionary = soundDatabase.ReadAll(); foreach (KeyValuePair <Int32, SoundProfile> keyValuePair in dictionary) { this.UnregisterBank(keyValuePair.Value); } soundDatabase.DeleteAll(); }
private void Start() { if (Instance == null) { Instance = this; } else if (Instance != this) { throw new Exception("There are multiple Sound Databases!"); } }
protected void LoadResource(SoundProfile soundProfile, SoundDatabase soundDatabase, SoundPlayer.LoadResourceCallback callback) { if (this.resourceLoadingCounter > 0) { callback((SoundDatabase)null, true); return; } this.resourceLoadingCounter = 1; this.activeCallback = callback; SoundLoaderProxy.Instance.Load(soundProfile, new ISoundLoader.ResultCallback(this.RegisterBankAsCallback), soundDatabase); }
public virtual void OnHitEffects(Damage dmg) { if (dmg.DidCrit) { SoundDatabase.PlaySound(11); } else { SoundDatabase.PlaySound(collideSoundID); } }
private void LoadSoundResourceCallback(SoundDatabase soundDatabase, Boolean isError) { if (!isError) { SoundLib.Log("LoadSoundResource is success"); } else { SoundLib.LogError("LoadSoundResource has Error"); this.soundDatabase.Delete(this.loadingSoundProfile); } }
public void Display(string text, float duration, NotificationType type) { StopAllCoroutines(); SoundDatabase.PlayNotificationSound(); SetWarningColor(type); icon.sprite = defaultIcon; this.text.text = text; StartCoroutine(DisplayOvertime(0.3f, duration)); }
public void HotkeyButton() { if (currentSkill.skillRank != 0) { SoundDatabase.PlaySound(18); hotkeyAssign.SetActive(!hotkeyAssign.activeInHierarchy); hotkeyDesc.text = "Where to assign " + currentSkill.skillName + " to?"; } else { EventNotifier.Instance.MakeEventNotifier("Skill not yet learned!"); } }
public void RankUpButton() { if (currentSkill.skillRank == currentSkill.skillMaxRank) { SoundDatabase.PlaySound(33); EventNotifier.Instance.MakeEventNotifier("Skill already at max rank!"); } else if (PlayerSkillController.Instance.RankUpSkill(currentSkill)) { EventNotifier.Instance.MakeEventNotifier(string.Format("{0} rank + 1 ({1}/{2})", currentSkill.skillName, currentSkill.skillRank, currentSkill.skillMaxRank)); SoundDatabase.PlaySound(20); PlayerSkillUpdate.SkillChanged(); } }
public void UnequipWeapon(Item item) { if (EquippedWeapon != null) { SoundDatabase.PlaySound(0); //print("unequipped"); //print(equippedWeapon.Stats.Physical); equippedWeapon.Stats.RemoveStatsFromOther(player.Stats); inventoryController.GiveItem(currentlyEquippedItem.Name); Destroy(playerHand.transform.GetChild(0).gameObject); UIEventHandler.ItemUnequipped(item); UIEventHandler.StatsChanged(); } }
private void LoadOnTheFlySoundResourceCallback(SoundDatabase soundDatabase, Boolean isError) { if (!isError) { if (this.activeSoundEffect != null) { this.PlaySoundEffect(this.activeSoundEffect); } } else { SoundLib.Log("LoadOnTheFlySoundResourceCallback is Error"); } }