// every filthy_particle has a certain script designed only for it, yet all of them are children of the main player script, this functions determines which script is used and establishes a reference to it private void FindThePlayerScript(GameObject player) { int type = player.GetComponent <UltimatePlayerScript>().typeOfParticle; if (type == 1) { player_E_particle_Script = player.GetComponent <E_particleScript>(); Player_script = player_E_particle_Script; } if (type == 2) { player_P_particle_Script = player.GetComponent <p_particleScript>(); Player_script = player_P_particle_Script; } if (type == 3) { player_N_particle_Script = player.GetComponent <N_particleScript>(); Player_script = player_N_particle_Script; } if (type == 4) { player_eBond_particle_Script = player.GetComponent <eBond_particleScript>(); Player_script = player_eBond_particle_Script; } if (type == 5) { player_Bond_particle_Script = player.GetComponent <BondsParticleScript>(); Player_script = player_Bond_particle_Script; } if (type == 6) { player_Ati_particle_Script = player.GetComponent <Ati_particleScript>(); Player_script = player_Ati_particle_Script; } }
private void Awake() { if (gameManagerObject == null) { gameManagerObject = GameObject.FindGameObjectWithTag("GameController"); } gameManagerScript = gameManagerObject.GetComponent <GameManager>(); if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); } playerScript = player.GetComponent <UltimatePlayerScript>(); }
private void Awake() { playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <UltimatePlayerScript>(); }