void Start() { boat = GameObject.Find("Boat").GetComponent <Boat>(); lifeGenerator = GameObject.Find("LifeHandler").GetComponent <LifeGenerator>(); rigidbody = GetComponent <Rigidbody>(); nitroEffect = gameObject.transform.GetChild(3).gameObject.GetComponent <ParticleSystem>(); nitroEffect.Stop(); AudioSource[] audioSources = GetComponents <AudioSource>(); throwFiguringSound = audioSources[0]; playerHurtSound = audioSources[1]; playerDieSound = audioSources[2]; collectNitroTankSound = audioSources[3]; nitroTankSound = audioSources[4]; waterSurface = audioSources[5]; swimSubmarineSound = audioSources[6]; }
void Start() { /* * We get the components made in the player's inspector */ animator = GetComponent <Animator>(); rigidBody2D = GetComponent <Rigidbody2D>(); spriteChild = transform.Find("PlayerSprite"); lifeGenerator = GameObject.Find("LifeGenerator").GetComponent <LifeGenerator>(); boat = GameObject.Find("Boat").GetComponent <Boat>(); particles = null; bubbles = transform.Find("Bubbles").GetComponentsInChildren <ParticleSystem>()[0]; hurtColor = transform.Find("PlayerSprite").GetComponentsInChildren <SpriteRenderer>()[0]; // Audio AudioSource[] audioSources = GetComponents <AudioSource>(); hurtSound = audioSources[0]; dieSound = audioSources[1]; nitroSound = audioSources[2]; collectNitroSound = audioSources[3]; }