20 lines
545 B
C#
20 lines
545 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SectionTriger : MonoBehaviour
|
|
{
|
|
public GameObject[] roadSection;
|
|
|
|
public float speed = -100f;
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.gameObject.CompareTag("Trigger"))
|
|
{
|
|
int randomNumber = Random.Range(0, roadSection.Length);
|
|
Instantiate(roadSection[randomNumber], new Vector3(0, 0, other.transform.position.z + speed), Quaternion.identity);
|
|
}
|
|
}
|
|
}
|