Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

How to make enemy shooting

// Some Attribute
public float fireRate = 0.5f;
private float nextFire = 0.0f;

// In Update
if(Time.time > nextFire) {
    if(!Bullet)
        return;
    nextFire = Time.time + fireRate;
    GameObject clone = Instantiate(Bullet, ShootPoint.position,ShootPoint.rotation);
    Rigidbody rb = clone.GetComponent<Rigidbody>();
    rb.AddRelativeForce(Vector3.forward * bulletSpeed, ForceMode.Impulse);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: moq set delay to return 
Csharp :: c# retry delay request 
Csharp :: unity draw waypoints path 
Csharp :: C# scrape html document 
Csharp :: winform fixed size 
Csharp :: persian datapicker 
Csharp :: c# get every point in a line in matrix 
Csharp :: get script directory c# 
Csharp :: unity apply bloom of a different color 
Csharp :: extension method in c# 
Csharp :: pick random point inside box collider unity 
Csharp :: Getting the text from a drop-down box 
Csharp :: guicontrol text ahk 
Csharp :: curl rest api keycloak 
Csharp :: unity array c# 
Csharp :: c# press ctrl and alt 
Csharp :: recorrer list c# 
Csharp :: httpclient getstringasync 
Csharp :: c# copy bidimensional array 
Csharp :: c# clear panel 
Csharp :: method c# 
Csharp :: sends keys enter selenium c# 
Csharp :: how to check to see if the keyboard buttons are pressed in unity 
Csharp :: how to show a first item in a combobox in c# winforms 
Csharp :: maximum sum subarray c# 
Csharp :: implicit vs explicit cast c# 
Csharp :: longest palindromic substring 
Csharp :: what are delegates and how to use them c# 
Csharp :: string vs string c# 
Csharp :: mongodb custom IIdGenerator 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =