void Start () { wallet = GetComponent<IHasMoolah>(); samples = new List<AudioSample>(); foreach (string str in PickPocketClipNames) { samples.Add(AudioManager.FindSampleFromCurrentLibrary(str)); } }
private void DoPickPocket(IHasMoolah otherGuysMoolah) { int stealAmount =otherGuysMoolah.Moolah; if(stealAmount>0) { wallet.Moolah += stealAmount; otherGuysMoolah.Moolah = 0; int randomIndex = Random.Range(0,PickPocketClipNames.Count); AudioManager.Play(samples[randomIndex],transform.position); } Debug.Log("PickPocket Succes: Stole " + stealAmount); }
private IEnumerator newValidBounceDelayCR(IHasMoolah otherMoolah) { //float pickPocketInputDelayWindow = 0.5f * PickPocketWindow; float start = Time.timeSinceLevelLoad; while (Time.timeSinceLevelLoad - start < PickPocketAfterBounce) { if(wantToPickPocket) { DoPickPocket(otherMoolah); wantToPickPocket = false; yield break; } yield return null; } }
private void newValidBounceDelay(IHasMoolah otherMoolah) { StartCoroutine(newValidBounceDelayCR(otherMoolah)); }