- Home /
Question by
Ascend_Dark · Jun 17, 2015 at 07:06 PM ·
particles
Particles For FPS Game
Hey i am fairly knew to Unity and was working on a very basic FPS game and i have recently tried implementing a muzzle flash it works good such as when "Fire1" is down but when an animation plays and "fire1" is still held down the particle continues any ideas on how to change this
public var particle: ParticleEmitter;
var WillFire = true;
var Reloading = false;
function Start ()
{
particle = particle.GetComponent.<ParticleEmitter>();
}
function Update ()
{
if(WillFire == true && Reloading == false){
if(Input.GetButton("Fire1"))
{
particle.emit = true;
}
else
{
particle.emit = false;
}
}
}
function ReloadAnim ()
{
Reloading = true;
WillFire = false;
yield WaitForSeconds(0.7);
Reloading = false;
WillFire = true;
}
This is what the ReloadAnim function is
function Reload(){
CanFire = false;
IsReloading = true;
BroadcastMessage("ReloadAnim");
yield WaitForSeconds(ReloadTime);
IsReloading = false;
CanFire = true;
AmmoLeft = AmmoInMag;
Comment