etol4040
Hectopat
- Katılım
- 10 Mayıs 2020
- Mesajlar
- 937
- Çözümler
- 7
ParticleSystem.Play diye bir kod var da onu nasıl kullanacağım? Ve emit yazınca compiler error veriyor.
Bütün kod:
Bütün kod:
C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AtesEtme : MonoBehaviour {
public float mermı, sarjor, taplammermi, menzil, hasar1, hasar2, sıradakiates, ateszamani, sayi, zaman, maxzaman;
public bool ates,reload;
RaycastHit hit;
ParticleSystem.Play muzzle;
public Text mermiyazi;
private object muzzzle;
void Start () {
zaman = maxzaman;
muzzle = GetComponentInChildren<ParticleSystem.Play> () ;
}
// Update is called once per frame
void Update () {
mermiyazi.text = ""+mermı+"/"+taplammermi;
if (Input.GetMouseButton(0) && mermı > 0 && Time.time > sıradakiates && !reload){
ates = true;
muzzzle.ParticleSystem.Play = true;
sıradakiates = Time.time + ateszamani;
mermı -= 1;
)
if (Input.GetMouseButtonUp (0) || mermi == 0) {
muzzle.ParticleSystem.Play = false;
}
if (Input.GetKeyDown(KeyCode.R) && mermı != 30 && !reload)
{
reload = true;
}
if (reload)
{
sayi = sarjor - mermı;
zaman -= Time.deltaTime;
if(zaman <= 0)
{
reload = false;
zaman = maxzaman;
if (sayi > taplammermi)
{
mermı += taplammermi;
taplammermi = 0;
}
if (sayi < taplammermi)
{
mermı += sayi;
taplammermi -= sayi;
}
}
}
}
void FixedUpdate()
{
if (ates) {
ates = false;
if (Physics.Raycast(Camera.main.transform.position,Camera.main.transform.forward,out hit,menzil)){
if(hit.transform.tag == "Dusman")
{
Debug.Log("düşmana değdin");
}
}
}
}
}
Son düzenleyen: Moderatör: