bigbangmove.cs 745 B

1234567891011121314151617181920212223242526272829
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class bigbangmove : MonoBehaviour {
  5. public float Speed;
  6. public GameObject explode;
  7. // Use this for initialization
  8. void Start () {
  9. explode = Resources.Load<GameObject>("Prefabs/Explode");
  10. }
  11. // Update is called once per frame
  12. void Update () {
  13. transform.Translate(Vector3.up*Speed*Time.deltaTime);
  14. }
  15. private void OnTriggerEnter(Collider other)
  16. {
  17. if (other.tag=="stone")
  18. {
  19. GameObject go = Instantiate(explode);
  20. go.transform.position = other.transform.position;
  21. Destroy(other.gameObject);
  22. ScoreManager.instance.Score+=10;
  23. }
  24. }
  25. }