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; } }
// Set to current captured block in trigger. public void CaptureBlock() { Block CapturedBlockScript = CapturedBlock.GetComponent <Block> (); SimpleFollow CapturedBlockSimpleFollow = CapturedBlock.GetComponent <SimpleFollow> (); Rigidbody CapturedBlockRigidbody = CapturedBlock.GetComponent <Rigidbody> (); ParentToTransform CapturedBlockParentToTransform = CapturedBlock.GetComponent <ParentToTransform> (); BlockFormation CapturedBlockParentBlockFormation = CapturedBlock.GetComponentInParent <BlockFormation> (); Rigidbody CapturedBlockParentRigidbody = CapturedBlock.GetComponentInParent <Rigidbody> (); if (CapturedBlockScript.isBossPart == false) { CapturedBlockRigidbody.isKinematic = false; CapturedBlockScript.OverwriteVelocity = true; CapturedBlockScript.isStacked = true; CapturedBlockScript.stack = this; CapturedBlockRigidbody.velocity = Vector3.zero; CapturedBlockSimpleFollow.enabled = true; CapturedBlockSimpleFollow.FollowPosX = transform; CapturedBlockSimpleFollow.FollowPosY = transform; CapturedBlockSimpleFollow.FollowPosZ = transform; isOccupied = true; if (stackSound.isPlaying == false) { stackSound.Play(); } if (CapturedBlockParentBlockFormation != null && CapturedBlockParentRigidbody != null) { CapturedBlockParentRigidbody.velocity = Vector3.zero; //CapturedBlockParentBlockFormation.enabled = false; CapturedBlockParentToTransform.ParentNow(); } } }