Files
az_tank_remake/3D/Assets/Scripts/BulletPrefab.cs

23 lines
528 B
C#
Raw Normal View History

2022-03-12 17:45:48 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletPrefab : MonoBehaviour
{
public float xForce;
public float yForce;
public float zForce = 30f;
public float destroyTime = 5f;
private void Start() {
xForce = 0;
yForce = 0;
zForce = 30;
Vector3 force = new Vector3(xForce, yForce, zForce);
GetComponent<Rigidbody>().velocity = force;
Destroy(gameObject, destroyTime); //Destroy after specified time
}
}