20 lines
445 B
C#
20 lines
445 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Test : MonoBehaviour
|
|
{
|
|
private void Update() {
|
|
if(Input.GetAxis("Vertical") != 0)
|
|
{
|
|
transform.Translate(Vector3.forward);
|
|
}
|
|
}
|
|
private void OnTriggerEnter(Collider other) {
|
|
if(other.gameObject.GetComponent<BoxCollider>() != null)
|
|
{
|
|
Destroy(other.gameObject);
|
|
}
|
|
}
|
|
}
|