"Unity Assets\items\FireSystem.cs(35,5): error" hatası

Katılım
16 Şubat 2020
Mesajlar
211
Çözümler
1
Daha fazla  
Cinsiyet
Erkek
Meslek
Öğrenci
Öncelikle merhaba, ben Unity'den bir oyun yapmaya çalışıyordum fakat Assets\items\FireSystem.cs(35,5): error CS1519: Invalid token 'void'in class, struct, or interface member declaration böyle bir hatayla karşılaştım. Ne yapacağımı bilmiyorum, hatanın olduğu metin belgesini size atayım. Önerileriniz var mı?

C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class FireSystem : MonoBehaviour.
{
public float reloadcooldown;
public float AmmoInGun;
public float AmmoInPocket;
public float AmmoMax;
float AddableAmmo;
float reloadtimer;
public Text AmmoCounter;
public Text PocketAmmoCounter;

public GameObject İmpactEffect;

RaycastHit hit;
public GameObject RayPoint;
public bool CamFire;
float gunTimer;
public float gunCooldown;
public ParticleSystem MuzzleFlash;

[Header("Oyun Sesleri")]
AudioSource SesKaynak;
public AudioClip FireSound;
public float range;

public AudioClip ReloadSound;
public AmmoCounter.

// Start is called before the first frame update.
void start () {

SesKaynak = GetComponent<AudioSource>();
GunAnimset = GetComponent<Animator>();
}

// Update is called once per frame.
void Update()
{
AmmoCouter.text = AmmoInGun.ToString();
PocketAmmoCounter.text = AmmoInPocket.ToString();

AddableAmmo = AmmoMax - AmmoInGun;

if (AddableAmmo > AmmoInPocket) ;
{
AddableAmmo = AmmoInPocket;
}
if (Input.GetKeyDown(KeyCode.R) && AddableAmmo > 0 && AmmoInPocket > 0)
{
if (Time.time > reloadtimer)
{
StartCoroutine(Reload());
reloadtimer = Time.time + reloadcooldown;
}

}

if (Input.GetKey(KeyCode.Mouse0) && CamFire == true && Time.time > gunTimer && AmmoInGun > 0)
{
Fire();
gunTimer = Time.time + gunCooldown;
}
}

void Fire()
{

if (Physics.Raycast(RayPoint.transform.position, RayPoint.transform.forward, out hit, range))
{
MuzzleFlash.Play();
SesKaynak.Play();
SesKaynak.clip = FireSound;
Debug.Log(hit.transform.name);

Instantiate(İmpactEffect, hit.point, Quaternion.LookRotation(hit.normal));
}
}

IEnumerator Reload() {
{
GunAnimset.SetBool("isReloading", true);

SesKaynak.clip = ReloadSound;
SesKaynak.Play();

yield return new WaitForSeconds(0.3f);
GunAnimset.SetBool("isReloading", false);

yield return new WaitForSeconds(1.4f);
AmmoInGun = AmmoInGun + AddableAmmo;
AmmoInPocket = AmmoInPocket - AddableAmmo;
}
}}
 

Yeni konular

Geri
Yukarı