Advertisement
dianamrazova

Unity Collecting Script

Dec 11th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class collecting : MonoBehaviour
  6. {
  7. public int value;
  8. public float rotateSpeed;
  9.  
  10.  
  11.  
  12. void Update()
  13. {
  14. gameObject.transform.Rotate(Vector3.up * Time.deltaTime * rotateSpeed);
  15. }
  16.  
  17. void OnTriggerEnter()
  18. {
  19. GameManager.instance.Collect(value, gameObject);
  20.  
  21. AudioSource source = GetComponent<AudioSource>();
  22. source.Play();
  23.  
  24.  
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement