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 PlayerController : MonoBehaviour
- {
- public Transform riffleStartPosition; // создаем переменную которая отвечает за старт выстрела
- public GameObject bullet;
- void Update()
- {
- if (Input.GetMouseButtonDown(0))
- {
- var bul = Instantiate(bullet, riffleStartPosition.position, riffleStartPosition.rotation);
- bul.GetComponent<Bullet>().SetDirection(transform.forward);
- bul.transform.rotation = transform.rotation;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement