public void Fire() { if (Time.time > this.FireRate + lastShot) { if (isPlayer) { PlayerAvatar avatar = gameObject.GetComponent <PlayerAvatar>(); if (avatar.Energy >= bulletPrefab.EnergyNeeded) { avatar.DecreaseEnergy(bulletPrefab.EnergyNeeded); shootBullet(); } } else { shootBullet(); } } }