void buy() { if (Input.GetKeyDown(KeyCode.Space) && !cooldown) { int price = getprice(index); //float price = GSSO.chestPrice; // if price is under current money if (boughtItems.Contains(index)) { return; } if (price <= GSSO.moneyCurrent) { // GameObject.Find("AudioController").GetComponent<AudioSource>().PlayOneShot(buyAudio); GSSO.moneyCurrent -= price; PlayerPrefs.SetInt(index.ToString(), 0); deleteBoughtItems(); //APPLY BOOST string name = getname(index); int k = getSOindex(index); GSSO.ApplyBonus(name, BS.Bonuses[k].value); } else { // GameObject.Find("AudioController").GetComponent<AudioSource>().PlayOneShot(not_enough_money); //Playsound } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player" || collision.tag == "Dash") { stateSO.ApplyBonus(name, value); particleSystem.Emit(18); collider2D.enabled = false; spriteRenderer.color = Color.clear; Destroy(gameObject, 1); } }