Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PowerUpCM : MonoBehaviour {
- void OnTriggerEnter(Collider other)
- {
- if (other.gameObject.CompareTag("Player"))
- {
- StartCoroutine(CMPickup(other));
- }
- }
- IEnumerator CMPickup(Collider other)
- {
- Debug.Log("PowerUp Picked Up!");
- GameManager coins = other.gameObject.GetComponent<GameManager>();
- coins.coinAmount *= FindObjectOfType<GameManager>().coinMultiplier;
- gameObject.SetActive(false);
- yield return new WaitForSeconds(FindObjectOfType<GameManager>().coinMultDuration);
- coins.coinAmount /= FindObjectOfType<GameManager>().coinMultiplier;
- Destroy(gameObject);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement