Assets/Eject.js(84,10): BCE0044: expecting (, found 'OnGUI'.
Assets/Eject.js(88,10): BCE0044: expecting (, found 'RemoveReserve'.
Assets/Eject.js(93,1): BCE0044: expecting }, found ''.
et voici mon script :
Code : Tout sélectionner
#pragma strict
var bulletCasing : Rigidbody;
var ejectSpeed : int = 100;
var fireRate : float = 0.5;
private var nextFire : float = 0.0;
private var fullAuto = false;
var clip : int = 30;
var maxclip : int = 30;
var reserve : int = 300;
var minreserve : int = 0;
var shotsound : AudioClip;
var reloadsound : AudioClip;
var MunMax : boolean = true;
var reloadsoundplay : boolean = false;
var automatic : boolean = true;
function Update () {
if(Input.GetButton("Fire1") && Time.time > nextFire){
if(clip >= 1){
nextFire = Time.time + fireRate;
var bullet : Rigidbody;
bullet = Instantiate(bulletCasing, transform.position, transform.rotation);
clip -= 1;
GetComponent.<AudioSource>().PlayOneShot(shotsound);
bullet.velocity = transform.TransformDirection(Vector3.left * ejectSpeed);
}
}
if(automatic == true){
if(Input.GetKeyDown("v")){
fullAuto = !fullAuto;
}
}
if(Input.GetKeyDown("r")){
if(reloadsoundplay == true){
GetComponent.<AudioSource>().PlayOneShot(reloadsound);
}
if(reserve > 30){
RemoveReserve();
clip += maxclip - clip;
}
if(reserve < 30){
clip += reserve;
RemoveReserve();
}
}
if(fullAuto == true){
fireRate = 0.10;
}else{
fireRate = 0.5;
}
if(reserve <= 0){
reserve = 0;
}
if(clip == maxclip){
reloadsoundplay = false;
}
if(clip < maxclip){
reloadsoundplay = true;
}
if(reserve == 0){
reloadsoundplay = false;
}
if(automatic == false){
fireRate = 1;
}
function OnGUI();{
GUI.Box(Rect(10,10,130,25), clip+ " / " +reserve);
}
function RemoveReserve();{
reserve -= maxclip - clip;
}