hello
I have this script
using UnityEngine;
using System.Collections;
public class helikopterscript : MonoBehaviour {
public float speed = 5;
RaycastHit hit;
public GameObject explosie;
public gamemanager Gamenager;
string positionsString = "";
public bool magbombdroppen = false;
// Use this for initialization
void Start () {
Gamenager = Camera.main.GetComponent<gamemanager>();
}
// Update is called once per frame
void Update () {
transform.Translate(Vector3.forward * speed * Time.deltaTime);
Debug.DrawRay(transform.position, -transform.up * 10, Color.green);
if (Physics.Raycast(transform.position, -transform.up, out hit, 10))
{
if (hit.collider.gameObject.tag == "vloer")
{
if(magbombdroppen == true)
{
if (Random.value > 0.5f)
{
//random time here
}
}
}
}
}
void ApplyDamage(float damage)
{
Gamenager.targetshit += 1;
Gamenager.AddPositionToPositionString(transform);
Instantiate(explosie, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
Destroy(gameObject);
}
void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "scoreeraf")
{
Gamenager.targetshit -= 1;
Destroy(gameObject);
}
if (col.gameObject.tag == "magbomdroppe")
{
magbombdroppen = true;
}
}
}
what i wanna do is when the random.value > 0.5 it needs to have a random time of like 1 to 5 seconds
But how do i do that?
Hope someone can help