void Awake() { //Set default values, calculate squared distances, etc. LOSLayermask = TacticalAI.ControllerScript.currentController.GetLayerMask(); if (!audioSource && bulletSpawn) { if (bulletSpawn.gameObject.GetComponent <AudioSource>()) { audioSource = bulletSpawn.gameObject.GetComponent <AudioSource>(); } } if (gameObject.GetComponent <SoundScript>()) { soundScript = gameObject.GetComponent <SoundScript>(); } if (!grenadeSpawn) { grenadeSpawn = bulletSpawn; } isFiring = false; isWaiting = false; currentBulletsUntilReload = bulletsUntilReload; timeBetweenBurstBullets = 1 / burstFireRate; timeBetweenBursts = 1 / rateOfFire; minBurstsPerVolley = (int)(minRoundsPerVolley / shotsPerBurst); maxBurstsPerVolley = (int)(maxRoundsPerVolley / shotsPerBurst); maxFiringAngle /= 2; maxSecondaryFireAngle /= 2; minimumDistToFireGun = minimumDistToFireGun * minimumDistToFireGun; maximumDistToFireGun = maximumDistToFireGun * maximumDistToFireGun; }
//Initiation stuff. void Awake() { soundScript = gameObject.GetComponent <TacticalAI.SoundScript>(); if (shields < 0) { shields = 0.1f; } maxShields = shields; }
public virtual void Initiate() { if (gameObject.GetComponent <TacticalAI.BaseScript>()) { baseScript = gameObject.GetComponent <TacticalAI.BaseScript>(); gunScript = baseScript.gunScript; soundScript = baseScript.audioScript; rotateToAimGunScript = baseScript.headLookScript; animationScript = baseScript.animationScript; coverFinderScript = baseScript.coverFinderScript; myTransform = baseScript.GetTranform(); layerMask = TacticalAI.ControllerScript.currentController.GetLayerMask(); navI = baseScript.GetAgent(); } }