//====================================== // USE Primary Fire // // Laser Effects void Update() // Laser Effects and Alt Fire // Update is called once per frame { // Max Laser Distance Raycast Var // 2Bats = Full if (barrierCounter == 0) { maxDistance = 12; } // 1Bat = 1/2 if (barrierCounter == 1) { maxDistance = 9; } // 0Bats = 0...duh if (barrierCounter == 2) { maxDistance = 7; } //====================================== if (isFiringLaser && !altFire) { // Laser Graphics if (!lineRenderer.enabled) { lineRenderer.enabled = true; impactEffect.Play(); // Particles impactLight.enabled = true; // Light sfx_AudioSource.Play(); //handLight.enabled = true; } //lineRenderer.SetPosition(0, firePoint.position); //lineRenderer.SetPosition(1, transform.forward * 10 + transform.position); // Max Distance // Rotate Direcion Particles Face Vector3 dir = firePoint.position - transform.forward * 10 + transform.position; // Vector with direction facing Player impactEffect.transform.rotation = Quaternion.LookRotation(dir); // Rotate Particle Collide } else // Turn Off Laser and Effects { lineRenderer.enabled = false; impactEffect.Stop(); // Particles impactLight.enabled = false; // Particle Lighting sfx_AudioSource.Stop(); // Stop Audio laserCollider = false; //handLight.enabled = false; // Lighting Effects Hands } //====================================== // ALTERNATE FIRE if (isFiringLaser && altFire) // Charge Shot Alt { if (canShoot == true) { BlueBulletController newBullet = Instantiate(bullet, firePoint.position, firePoint.rotation) as BlueBulletController; canShoot = false; } } //====================================== // USE ABILITIES // // Barrier if (holdingBarrier && barrierCounter < 2) // Charge Shot Alt { BlueBarrierController newBarrier = Instantiate(barrier, barrierDeployPoint.position, barrierDeployPoint.rotation) as BlueBarrierController; holdingBarrier = false; barrierCounter += 1; } // Turret if (holdingTurret && barrierCounter < 2) // Charge Shot Alt { BlueTurretController newTurret = Instantiate(turret, barrierDeployPoint.position, barrierDeployPoint.rotation) as BlueTurretController; holdingTurret = false; barrierCounter += 1; } }
void Awake() // INITIALIZE VARIABLES { turret = GetComponent <BlueTurretController>(); }
//====================================== // USE Primary Fire // // Laser Effects void Update() // Laser Effects and Alt Fire // Update is called once per frame { // Max Laser Distance Raycast Var // 2Bats = Full if (barrierCounter == 0) { maxDistance = 12; } // 1Bat = 1/2 if (barrierCounter == 1) { maxDistance = 9; } // 0Bats = 0...duh if (barrierCounter == 2) { maxDistance = 7; } //====================================== if (isFiringLaser && !altFire) { // Laser Graphics if (!lineRenderer.enabled) { lineRenderer.enabled = true; impactEffect.Play(); // Particles impactLight.enabled = true; // Light sfx_AudioSource.AudioSource_01.Play(); sfx_AudioSource.AudioSource_02.Play(); } // Rotate Direcion Particles Face Vector3 dir = firePoint.position - transform.forward * 10 + transform.position; // Vector with direction facing Player impactEffect.transform.rotation = Quaternion.LookRotation(dir); // Rotate Particle Collide } else // Turn Off Laser and Effects { TurnOffLaser(); } //====================================== // ALTERNATE FIRE if (isFiringLaser && altFire) // Charge Shot Alt { if (bluePlayer.useController == true) { if (canOrb == true & Input.GetKeyDown(KeyCode.Joystick1Button7)) { BlueOrbController newOrb = Instantiate(orb, orbPoint.position, orbPoint.rotation) as BlueOrbController; canOrb = false; } } if (bluePlayer.useController == false) { if (canOrb == true & Input.GetMouseButtonDown(0)) { BlueOrbController newOrb = Instantiate(orb, orbPoint.position, orbPoint.rotation) as BlueOrbController; canOrb = false; } } } //====================================== // USE ABILITIES // // Barrier if (canHoldBarrier == true && barrierCounter < 2 && canDeploy) { BlueBarrierController newBarrier = Instantiate(barrier, barrierDeployPoint.position, barrierDeployPoint.rotation) as BlueBarrierController; canHoldBarrier = false; canDeploy = false; barrierCounter += 1; // Turn Off Laser TurnOffLaser(); isFiringLaser = false; // Turn Off Blue Can Shoot bluePlayer.canShoot = false; // Turn Off Can Orb canOrb = false; } // Turret if (canHoldTurret == true && barrierCounter < 2 && canDeploy) { BlueTurretController newTurret = Instantiate(turret, turretDeployPoint.position, turretDeployPoint.rotation) as BlueTurretController; canHoldTurret = false; canDeploy = false; barrierCounter += 1; // Turn Off Laser TurnOffLaser(); isFiringLaser = false; // Turn Off Blue Can Shoot bluePlayer.canShoot = false; // Turn Off Can Orb canOrb = false; } }