Here is the code:
void ProcessFiring()
{
if (Input.GetButton (“Fire1”))
{
SetLasersActive(true);
}
else
{
SetLasersActive(false);
}
}
void SetLasersActive(bool isActive)
{
foreach (GameObject laser in lasers)
{
var emissionModule = laser.GetComponent<ParticleSystem>().emission;
emissionModule.enabled = isActive;
}
What I’m not getting has to do with the bool values. When fire1 is pressed, the method SetLasersActive is set to true. Since we have (bool isActive) as a parameter does this mean that the variable isActive is also set to true? And by extension does this mean emissionModule.enabled is set to true? I’m pretty sure I’m just getting hung up on this due to formatting but I want to make sure I have a grasp on the logic here.