using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class delcube : MonoBehaviour {
public Text textUI;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(transform.position.y<=0)
{
Debug.Log("finish");
renew.score += 10;
Destroy(gameObject);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class renew : MonoBehaviour {
public GameObject cubeBlue;
private float timer;
public static int score = 0;
public Text text;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
text.text = score.ToString();
if (timer > 3)
{
Vector3 pos = new Vector3(Random.Range(-3, 3), 3, Random.Range(-3, 3));
Instantiate(cubeBlue, pos, Quaternion.identity);
timer = 0;
}
else
timer += Time.deltaTime;
}
}