public void Fight() { ToggleMode(false); SetMainText(group.FightText); decimal diff = Global.Player.CombatProficiency - group.CombatProficiency; if (group.Name.Equals("band of dwarves") || group.Name.Equals("Swamp Settlers")) { Debug.Log(group.Name); GlobalSound.Play(SOUNDS.SWORDFIGHT); } if (group.Name.Equals("armored knight")) { GlobalSound.Play(SOUNDS.SWORDDRAW); } if ((decimal)Random.value < .5m + diff) { AbstractItem aItem = Catalog.RandomItem(Global.Level); Item item = new Item(aItem.Name, 1, 0); SetFollowUpText("You win the battle, and the " + group.Name + " offers you " + item.Name + "."); Global.Player.GiveItem(item); } else { int damage = Random.Range(damageRange.X, damageRange.Y + 1); SetFollowUpText("You lose the battle taking " + damage.ToString() + " damage."); Global.Player.TakeDamage((short)damage); } }
public void PlayOnce(GlobalSound name) { Sound s = FindSound(name); if (s != null && !s.source.isPlaying) { s.source.Play(); } }
public void ResumeIfPaused(GlobalSound name) { Sound s = FindSound(name); if (s != null && PausedSounds.Contains(s)) { s.source.Play(); PausedSounds.Remove(s); } }
public void PauseIfPlaying(GlobalSound name) { Sound s = FindSound(name); if (s != null && s.source.isPlaying) { s.source.Pause(); PausedSounds.Add(s); } }
public void TakeDamage(short damage) { currentHealth -= damage; Global.Health.ValueChanged(currentHealth); GlobalSound.Play(SOUNDS.LOSEHEALTH); if (currentHealth <= 0) { die(); } }
private Sound FindSound(GlobalSound name) { Sound s = System.Array.Find(GlobalSounds, sound => sound.name == name); if (s == null) { Debug.LogWarning("Sound '" + name + "' does not exist in GlobalSounds Array!"); return(null); } return(s); }
public void Sell() { if (Global.Player.Has(item)) { Global.Player.Gold += parentWindow.SellAt(index); Global.Player.TakeItem(item); } else { Debug.Log("player doesnt have item"); GlobalSound.Play(SOUNDS.NEGATIVE); } }
public void Buy() { if (Global.Player.Gold >= item.Price) { Global.Player.GiveItem(parentWindow.BuyAt(index)); updateText(); } else { Debug.Log("not enough gold"); GlobalSound.Play(SOUNDS.NEGATIVE); } }
public void Start() { source = GetComponent <AudioSource>(); instance = this; }
void Awake() { instance = this; }
void Awake() { _audio = GetComponent <AudioSource>(); instance = this; PlayBGM(); }
void Awake() { _audio = GetComponent<AudioSource>(); instance = this; PlayBGM(); }
public void Stop(GlobalSound name) { Sound s = FindSound(name); s?.source.Stop(); }
public void Play(GlobalSound name) { Sound s = FindSound(name); s?.source.Play(); }
public void Start() { source = GetComponent<AudioSource>(); instance = this; }