private void Start() { // Get components playerController = GetComponent <PlayerController>(); inputManager = InputManager.instance; bulletCounter = GameObject.FindGameObjectWithTag("BulletManager").GetComponent <BulletCounter>(); // Get main particle system // ParticleSystem chargeParticleSystem = chargeParticles.GetComponent<ParticleSystem>(); // chargeParticleSystemMain = chargeParticleSystem.main; bulletCounter.IncreaseBulletAmount(); // Add 1 to the current amount of bullets }
void Shoot(int chargeLevel) { if (!playerController.isOnWall) // If not on wall { if (playerController.isFacingLeft) // Facing left { currentBulletSpawnPos = leftBulletSpawnPosition.position; // Spawn from the left } else { currentBulletSpawnPos = bulletSpawnPosition.position; // Spawn from the right } } else { if (playerController.isFacingLeft) // Shoot from the oppsosite position if on a wall { currentBulletSpawnPos = bulletSpawnPosition.position; } else { currentBulletSpawnPos = leftBulletSpawnPosition.position; } } nextChargeTime = Time.time + chargeLevelTimes[currentChargeLevel]; PlayerController.playerAudioManager.Play(shootSounds[currentChargeLevel]); // PlayerController.playerAudioManager.Stop("Charge"); nextFireTime = Time.time + timeBetweenFire; if (!playerController.foundWall) { bulletCounter.IncreaseBulletAmount(); // Add 1 to the current amount of bullets Instantiate(bullets[currentChargeLevel], currentBulletSpawnPos, bulletSpawnPosition.rotation); // Create a bullet } currentChargeLevel = 0; }