31 lines
458 B
C#
31 lines
458 B
C#
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class ObsctaleScript : MonoBehaviour
|
||
|
|
{
|
||
|
|
|
||
|
|
private float deathTime;
|
||
|
|
private float myTime = 0.0f;
|
||
|
|
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
|
||
|
|
deathTime = Random.Range(5.0f, 15.0f);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
|
||
|
|
myTime += Time.deltaTime;
|
||
|
|
|
||
|
|
if(myTime > deathTime)
|
||
|
|
{
|
||
|
|
Destroy(gameObject);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|