protected virtual void Awake() { weaponManager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <WeaponManager>(); levelManager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <LevelManager>(); playerManager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <PlayerManager>(); playerWeaponManager = GameObject.FindGameObjectWithTag("Player").GetComponent <playerWeaponManager>(); myFrequencyMode = playerManager.FrequencyMode; delayTimer = gameObject.AddComponent <Timer>(); delayTimer.Trigger += ReadyToFire; projectileBounds = levelManager.bounds; }
void Awake() { playerManager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <PlayerManager>(); weaponManager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <WeaponManager>(); myFrequencyMode = playerManager.FrequencyMode; frequencyDisplay = playerManager.FrequencyDisplay.GetComponent <TextMesh>(); colorDisplay = playerManager.ColorDisplay.GetComponent <Renderer>(); weaponDisplay = playerManager.WeaponDisplay.GetComponent <TextMesh>(); weaponColorGlow = playerManager.WeaponColorGlow; colorDisplay.material.color = Color.blue; weaponColorGlow.GetComponent <ParticleSystem>().startColor = new Color(0, 0, 1, 0.90f); if (playerManager.HasPositron) { GameObject newWeapon = (GameObject)Instantiate(weaponManager.PositronGun, transform.position, Quaternion.identity); newWeapon.transform.parent = transform; attachedWeapons[0] = newWeapon.GetComponent <Weapon>(); } if (playerManager.HasNegatron) { GameObject newWeapon = (GameObject)Instantiate(weaponManager.NegatronGun, transform.position, Quaternion.identity); newWeapon.transform.parent = transform; attachedWeapons[1] = newWeapon.GetComponent <Weapon>(); } if (playerManager.HasDisintegrator) { GameObject newWeapon = (GameObject)Instantiate(weaponManager.Disintegrator, transform.position, Quaternion.identity); newWeapon.transform.parent = transform; attachedWeapons[2] = newWeapon.GetComponent <Weapon>(); } if (playerManager.HasMultizapper) { GameObject newWeapon = (GameObject)Instantiate(weaponManager.Multizapper, transform.position, Quaternion.identity); newWeapon.transform.parent = transform; attachedWeapons[3] = newWeapon.GetComponent <Weapon>(); } if (playerManager.HasFactorBeam) { GameObject newWeapon = (GameObject)Instantiate(weaponManager.FactorBeam, transform.position, Quaternion.identity); newWeapon.transform.parent = transform; attachedWeapons[4] = newWeapon.GetComponent <Weapon>(); } }