I am getting these errors:
Assets/Scripts/WeaponFunctionality.cs(47,44): error CS1525: Unexpected symbol `else’
Assets/Scripts/WeaponFunctionality.cs(82,18): error CS1519: Unexpected symbol `if’ in class, struct, or interface member declaration
Assets/Scripts/WeaponFunctionality.cs(82,33): error CS1519: Unexpected symbol `==’ in class, struct, or interface member declaration
Assets/Scripts/WeaponFunctionality.cs(83,35): error CS1519: Unexpected symbol `=’ in class, struct, or interface member declaration
Assets/Scripts/WeaponFunctionality.cs(84,33): error CS1519: Unexpected symbol `=’ in class, struct, or interface member declaration
Assets/Scripts/WeaponFunctionality.cs(87,35): error CS1519: Unexpected symbol `=’ in class, struct, or interface member declaration
Assets/Scripts/WeaponFunctionality.cs(88,33): error CS1519: Unexpected symbol `=’ in class, struct, or interface member declaration
Assets/Scripts/WeaponFunctionality.cs(91,18): error CS8025: Parsing error
Any ideas?
using UnityEngine;
using System.Collections;
public class WeaponFunctionality : MonoBehaviour
{
public GameObject ShootPoint;
public RaycastHit Hit;
public float RateOfFire = 0.15f;
public float CoolerTimer = 0.0f;
public bool CanFire = false;
private Transform _MyTransform;
//reload variables
public int CurrentClips = 5;
public int CurrentBullets = 0;
public float ReloadTime = 2.8f;
public float ReloadCoolerTimer = 0.0f;
public bool CanReload = false;
private int BulletsPerClip = 30;
private bool _IsReloading = false;
private bool _IsFiring = false;
void Start ()
{
_MyTransform = transform;
CurrentBullets = BulletsPerClip;
}
void Update ()
{
Debug.DrawRay(ShootPoint.transform.position, ShootPoint.transform.forward, Color.magenta, 100);
if(CanFire)
{
if(CurrentBullets > 0)
{
if(Input.GetKey(KeyCode.LeftControl))
{
if(Physics.Raycast(ShootPoint.transform.position, ShootPoint.transform.forward, out Hit));
{
Debug.Log(Hit.transform.name);
CurrentBullets--;
CoolerTimer = RateOfFire;
}
else
{
CurrentBullets--;
CoolerTimer = RateOfFire;
}
}
}
else
{
if(CanReload)
{
if(CurrentClips > 0)
{
_IsReloading = true;
ReloadCoolerTimer = ReloadTime;
_MyTransform.animation.CrossFade("Reload");
Reload(false);
}
}
}
if(CanReload)
{
if(Input.GetKeyDown(KeyCode.R))
{
if(CurrentClips > 0)
{
_IsReloading = true;
ReloadCoolerTimer = ReloadTime;
Reload(true);
}
}
}
}
if(CoolerTimer == 0.0f)
_IsFiring = false;
CanFire = true;
else
{
_IsFiring = true;
CanFire = false;
}
if(CoolerTimer > 0)
CoolerTimer -= Time.deltaTime;
else if(CoolerTimer < 0)
CoolerTimer = 0;
if(ReloadCoolerTimer == 0.0f)
CanReload = true;
else
CanReload = false;
if(ReloadCoolerTimer > 0)
ReloadCoolerTimer -= Time.deltaTime;
else if(ReloadCoolerTimer < 0)
ReloadCoolerTimer = 0;
}
private void Reload(bool ForcedReload)
{
if(!ForcedReload)
{
CurrentBullets = BulletsPerClip;
CurrentClips--;
_IsReloading = false;
}
else
{
CurrentBullets = BulletsPerClip;
CurrentClips--;
_IsReloading = false;
}
}
}