Advertisement
kadyr

Untitled

Jul 4th, 2021
968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Bullet : MonoBehaviour
  6. {
  7.     [SerializeField]
  8.     private float speed = 10f;
  9.     Vector3 direction;
  10.     void Start()
  11.     {
  12.        
  13.     }
  14.     public void SetDirection(Vector3 dir)
  15.     {
  16.         direction = dir;
  17.     }
  18.     private void FixedUpdate()
  19.     {
  20.         transform.position += direction *speed*Time.fixedDeltaTime;
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement