Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEditor;
- using UnityEngine;
- public class Drive : MonoBehaviour
- {
- public float speed;
- public Transform bulletLaunchPos;
- public GameObject bulletPrefab;
- // Update is called once per frame
- void Update()
- {
- float translation = Input.GetAxis("Horizontal") * speed;
- translation *= Time.deltaTime;
- transform.Translate(translation, 0, 0);
- if (Input.GetKeyDown(KeyCode.Space))
- {
- //Instantiate(bulletPrefab, bulletLaunchPos.position, Quaternion.identity);
- GameObject b = PoolManager.singleton.Get("bullet");
- if (b != null)
- {
- b.transform.position = this.transform.position;
- b.SetActive(true);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement