2024-06-14 16:58:09 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class WeaponScript : MonoBehaviour
|
|
|
|
{
|
|
|
|
|
2024-06-14 19:08:04 +02:00
|
|
|
public GameObject spawnpoint;
|
2024-06-14 16:58:09 +02:00
|
|
|
public GameObject bullet;
|
|
|
|
|
2024-06-14 19:08:04 +02:00
|
|
|
private void shoot(){
|
2024-06-14 16:58:09 +02:00
|
|
|
if(Input.GetKeyDown(KeyCode.Mouse0)){
|
2024-06-14 19:08:04 +02:00
|
|
|
Instantiate(bullet,spawnpoint.transform.position,transform.rotation);
|
2024-06-14 16:58:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
shoot();
|
|
|
|
}
|
|
|
|
}
|