public void Start() { // Find external scripts. camShakeScript = GameObject.Find("CamShake").GetComponent <CameraShake> (); parentToTransformScript = GetComponent <ParentToTransform> (); timeBodyScript = GetComponent <TimeBody> (); // Finds texture scroll script. if (textureScrollScript == null) { textureScrollScript = GetComponentInChildren <ScrollTextureOverTime> (true); } // If not connected to a block formation, set property to not connected to block formation. if (blockFormationScript == null) { isBlockFormationConnected = false; return; } // If connected to a block formation, set property to connected. if (blockFormationScript != null) { isBlockFormationConnected = true; } }
// MiniBoss script calls this on all its children blocks. public void ConvertToNoiseBossPart() { // Checks if this is a boss part, it doesnt have a parent, and did not get attached yet. HitPoints = 1; isSpecialBlockType = true; // Set to special block type. SpecialBlockType = specialBlockType.Noise; // Set to block type list. if (textureScrollScript == null) { if (GetComponentInChildren <ScrollTextureOverTime> () != null) { textureScrollScript = GetComponentInChildren <ScrollTextureOverTime> (); textureScrollScript.enabled = true; // Turn on texture scroll script. } } UpdateBlockType(); speed = NoiseBlock.Speed; // Freeze speed. rend.material = NoiseBlock.Material; // Set material to noise. BasePointValue = NoiseBlock.BasePointValue; // Reset base point value. TextColor = NoiseBlock.TextColor; // set gray text color. Explosion = NoiseBlock.Explosion; // Set noise explosion. particleAttractSpeed = NoiseBlock.particleAttractionSpeed; particleAttractInitialDelay = NoiseBlock.particleAttractorInitialDelay; GetComponentInChildren <Animator> (true).enabled = false; // Set scale for noise. transform.localScale = new Vector3 ( 0.9f * transform.localScale.x, 0.9f * transform.localScale.y, 0.9f * transform.localScale.z ); transform.rotation = Quaternion.identity; // Reset rotation. GotDetached = true; // Set detached state. parentToTransformScript.enabled = true; // Parent to transform. if (GetComponentInChildren <ParticleSystem> () != null) { GetComponentInChildren <ParticleSystem> ().Stop(); } CheckForNoiseBoundary(); }
// Updates properties of block type periodically. void UpdateBlockType() { // For special block types. if (isSpecialBlockType == true) { switch (SpecialBlockType) { case specialBlockType.Noise: speed = NoiseBlock.Speed; rend.material = NoiseBlock.Material; BasePointValue = NoiseBlock.BasePointValue; AddAbilityTime = NoiseBlock.AddAbilityTime; TextColor = NoiseBlock.TextColor; Explosion = NoiseBlock.Explosion; particleAttractSpeed = NoiseBlock.particleAttractionSpeed; particleAttractInitialDelay = NoiseBlock.particleAttractorInitialDelay; transform.name = "Noise block"; transform.GetChild(0).name = "Noise block child"; if (textureScrollScript == null) { if (GetComponentInChildren <ScrollTextureOverTime> () != null) { textureScrollScript = GetComponentInChildren <ScrollTextureOverTime> (); textureScrollScript.enabled = true; // Turn on texture scroll script. } } break; case specialBlockType.Red: speed = RedBlock.Speed; rend.material = RedBlock.Material; BasePointValue = RedBlock.BasePointValue; AddAbilityTime = RedBlock.AddAbilityTime; TextColor = RedBlock.TextColor; Explosion = RedBlock.Explosion; particleAttractSpeed = RedBlock.particleAttractionSpeed; particleAttractInitialDelay = RedBlock.particleAttractorInitialDelay; transform.name = "Red block"; transform.GetChild(0).name = "Red block child"; break; } return; // Don't bother checking for normal block type changes if this was executed. } // Check for normal block type changes. if (isSpecialBlockType == false) { if (GetComponentInChildren <ParticleSystem> () != null) { GetComponentInChildren <ParticleSystem> ().Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); } if (textureScrollScript == null) { if (GetComponentInChildren <ScrollTextureOverTime> () != null) { textureScrollScript = GetComponentInChildren <ScrollTextureOverTime> (); textureScrollScript.CurrentOffset = Vector2.zero; textureScrollScript.enabled = false; // Turn off texture scroll script. } } // Update speed stat. // Update material stat. // Update base point value stat. // Update change explosion text color reference stat. switch (BlockType) { case mainBlockType.Aqua: speed = AquaBlock.Speed; rend.material = AquaBlock.Material; BasePointValue = AquaBlock.BasePointValue; AddAbilityTime = AquaBlock.AddAbilityTime; TextColor = AquaBlock.TextColor; Explosion = AquaBlock.Explosion; particleAttractSpeed = AquaBlock.particleAttractionSpeed; particleAttractInitialDelay = AquaBlock.particleAttractorInitialDelay; transform.name = "Aqua block"; transform.GetChild(0).name = "Aqua block child"; break; case mainBlockType.Blue: speed = BlueBlock.Speed; rend.material = BlueBlock.Material; BasePointValue = BlueBlock.BasePointValue; AddAbilityTime = BlueBlock.AddAbilityTime; TextColor = BlueBlock.TextColor; Explosion = BlueBlock.Explosion; particleAttractSpeed = BlueBlock.particleAttractionSpeed; particleAttractInitialDelay = BlueBlock.particleAttractorInitialDelay; transform.name = "Blue block"; transform.GetChild(0).name = "Blue block child"; break; case mainBlockType.Purple: speed = PurpleBlock.Speed; rend.material = PurpleBlock.Material; BasePointValue = PurpleBlock.BasePointValue; AddAbilityTime = PurpleBlock.AddAbilityTime; TextColor = PurpleBlock.TextColor; Explosion = PurpleBlock.Explosion; particleAttractSpeed = PurpleBlock.particleAttractionSpeed; particleAttractInitialDelay = PurpleBlock.particleAttractorInitialDelay; transform.name = "Purple block"; transform.GetChild(0).name = "Purple block child"; break; case mainBlockType.Pink: speed = PinkBlock.Speed; rend.material = PinkBlock.Material; BasePointValue = PinkBlock.BasePointValue; AddAbilityTime = PinkBlock.AddAbilityTime; TextColor = PinkBlock.TextColor; Explosion = PinkBlock.Explosion; particleAttractSpeed = PinkBlock.particleAttractionSpeed; particleAttractInitialDelay = PinkBlock.particleAttractorInitialDelay; transform.name = "Pink block"; transform.GetChild(0).name = "Pink block child"; break; } } }