Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Shooter : MonoBehaviour {
- public GameObject shotPrefab;
- public float shotVelocity = 20.0f;
- void Start () {
- }
- void Update () {
- if (Input.GetMouseButtonDown (0))
- {
- GameObject shot = GameObject.Instantiate(shotPrefab, transform.position, transform.rotation) as GameObject;
- shot.GetComponent<Rigidbody>().velocity = transform.forward * shotVelocity;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement