Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PickUpObject : MonoBehaviour
- {
- public int ringValue = 0;
- public int powerValue = 0;
- public GameObject vis;
- private void OnTriggerEnter(Collider other)
- {
- if (other.TryGetComponent(out UltimatePlayerMovement player))
- {
- StartCoroutine(PickUp());
- }
- }
- private void Update()
- {
- transform.Rotate(Vector3.up, 90 * Time.deltaTime);
- }
- private IEnumerator PickUp()
- {
- HUD.teamBlastFillUp += powerValue;
- GameInstance.currentRings+= ringValue;
- vis.SetActive(false);
- GetComponent<Collider>().enabled = false;
- AudioSource source = GetComponent<AudioSource>();
- source.Play();
- while (source.isPlaying)
- {
- yield return new WaitForEndOfFrame();
- }
- Destroy(gameObject);
- }
- }
Add Comment
Please, Sign In to add comment