1234567891011121314151617181920212223242526272829 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class bigbangmove : MonoBehaviour {
- public float Speed;
- public GameObject explode;
- // Use this for initialization
- void Start () {
- explode = Resources.Load<GameObject>("Prefabs/Explode");
- }
- // Update is called once per frame
- void Update () {
- transform.Translate(Vector3.up*Speed*Time.deltaTime);
- }
- private void OnTriggerEnter(Collider other)
- {
- if (other.tag=="stone")
- {
- GameObject go = Instantiate(explode);
- go.transform.position = other.transform.position;
- Destroy(other.gameObject);
- ScoreManager.instance.Score+=10;
- }
- }
- }
|