Can someone help me translate this to c#?

We really really need this done within the next two or three days. We’ll credit whoever does it first in our game. Thanks so much!

#pragma strict
var spawner : Transform;
var projectile : Transform;
var bulletCount = 0;
var damp = .3;
static var fastFire = false;
private var nextFire = 0.0;
var fireRate = 0.1;

function Start () {
bulletCount = 0;
}

function Update () {
var playerplane = new Plane(Vector3.up, transform.position);
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var target = 0.0;
 if(playerplane.Raycast (ray, target)){
	var targetpoint = ray.GetPoint(target);
	var targetRotation = Quaternion.LookRotation(targetpoint - transform.position);
	//transform.rotation = targetRotation;
	transform.rotation = Quaternion.Slerp(transform.rotation,targetRotation, Time.deltaTime * damp);
	}

// && bulletCount <7

if(Input.GetMouseButtonDown(0) && fastFire == false)
 {
  bulletCount += 1;
  var bullet = Instantiate(projectile,spawner.position,Quaternion.identity);
   bullet.rigidbody.AddForce(transform.forward * 1000);
   audio.Play();
 }	
 if(Input.GetMouseButton(0) && fastFire && Time.time > nextFire)
 {
  nextFire = Time.time + fireRate;
  bulletCount += 1;
  var bullet2 = Instantiate(projectile,spawner.position,Quaternion.identity);
   bullet2.rigidbody.AddForce(transform.forward * 1000);
   audio.Play();

   
 }
// bullet.rigidbody.AddForce(transform.forward * 1000)x;
	
	
	
}

Thank you so much :slight_smile:

I had some time so I made it for you:

public Transform spawner;
public Transform projectile;
public int bulletCount = 0;
public float damp = 0.3f;
Transform static bool fastFire = false;
private float nextFire = 0.0f;
public float fireRate = 0.1f;

private Ray ray;
public float target;
public GameObject bullet,bullet2;
public Vector3 targetpoint;
public Quaternion targetRotation;
public bool fastFire = false;

void Start () {
bulletCount = 0;
}

void Update () {
Plane playerplane = new Plane(Vector3.up, transform.position);
ray = Camera.main.ScreenPointToRay (Input.mousePosition);
target = 0.0f;
 if(playerplane.Raycast (ray, out target)){
    targetpoint = ray.GetPoint(target);
    targetRotation = Quaternion.LookRotation(targetpoint - transform.position);
    //transform.rotation = targetRotation;
    transform.rotation = Quaternion.Slerp(transform.rotation,targetRotation, Time.deltaTime * damp);
    }

// && bulletCount <7

if(Input.GetMouseButtonDown(0) && fastFire == false)
 {
  bulletCount += 1;
  bullet = Instantiate(projectile,spawner.position,Quaternion.identity);
  bullet.rigidbody.AddForce(transform.forward * 1000);
  audio.Play();
 }  
 if(Input.GetMouseButton(0) && fastFire && Time.time > nextFire)
 {
  nextFire = Time.time + fireRate;
  bulletCount += 1;
  bullet2 = Instantiate(projectile,spawner.position,Quaternion.identity);
  bullet2.rigidbody.AddForce(transform.forward * 1000);
  audio.Play();


 }
// bullet.rigidbody.AddForce(transform.forward * 1000)x;

You can play around with the public/private however you want. I didn’t test this so if it gives you errors let me know and i’ll try to fix it.