СОЗДАЕМ КС2 НА ЮНИТИ!!!

BulletController using System.Collections; using System.Collections.Generic; using UnityEngine; public class BulletController : MonoBehaviour { void Start() { Destroy(gameObject, 1); } private void OnCollisionEnter(Collision collision) { Destroy(gameObject); } } Shoot using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; public class Shoot : MonoBehaviour { [SerializeField] GameObject bullet; [SerializeField] Transform shootPoint; [SerializeField] float power; void Update() { if (Input.GetMouseButtonDown(0)) { GameObject newBullet = Instantiate(bullet, shootPoint.position, bullet.transform.rotation); newBullet.GetComponent().AddForce(transform.forward * power, ForceMode.Impulse); } } }

12+
5 просмотров
2 дня назад
12+
5 просмотров
2 дня назад

BulletController using System.Collections; using System.Collections.Generic; using UnityEngine; public class BulletController : MonoBehaviour { void Start() { Destroy(gameObject, 1); } private void OnCollisionEnter(Collision collision) { Destroy(gameObject); } } Shoot using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; public class Shoot : MonoBehaviour { [SerializeField] GameObject bullet; [SerializeField] Transform shootPoint; [SerializeField] float power; void Update() { if (Input.GetMouseButtonDown(0)) { GameObject newBullet = Instantiate(bullet, shootPoint.position, bullet.transform.rotation); newBullet.GetComponent().AddForce(transform.forward * power, ForceMode.Impulse); } } }

, чтобы оставлять комментарии