/// <summary> /// This function is called each time the ActivatedBlock script is enabled by the Platform /// It obtains references to necessary components on the parent block to be changed. /// It intiializes the Block to reflect the color of the Player assigned /// </summary> private void OnEnable() { PV = GetComponent <PhotonView>(); gameObject.tag = "Question"; // Get Parent Block and Components parentBlock = transform.parent.gameObject; TCC = parentBlock.transform.parent.gameObject.GetComponent <TileColorController>(); rend = parentBlock.GetComponent <MeshRenderer>(); rb = parentBlock.GetComponent <Rigidbody>(); highlight = parentBlock.transform.GetChild(1).gameObject; // Ensures Parent Block does not fall rb.isKinematic = true; // Lifts parent block up for it to be noticed by players parentBlock.transform.Translate(Vector3.up * .15f); // Intializes parent block color based on player assigned Material[] materials = rend.materials; materials[0] = TCC.getTileMaterial(colorIndex); rend.materials = materials; // Initializes playerTag to identify correct Player playerTag = "Player" + playerIndex; }
/// <summary> /// This function is called each time the SpecialBlock script is enabled by the Platform /// It obtains references to necessary components on the parent block to be changed. /// It intiializes the Block and PowerUp for the required functionality /// </summary> private void OnEnable() { PV = GetComponent <PhotonView>(); gameObject.tag = "SpecialQuestion"; // Get Parent Block and Components parentBlock = transform.parent.gameObject; TCC = parentBlock.transform.parent.gameObject.GetComponent <TileColorController>(); rend = parentBlock.GetComponent <MeshRenderer>(); rb = parentBlock.GetComponent <Rigidbody>(); highlight = parentBlock.transform.GetChild(1).gameObject; // Ensures Parent Block does not fall rb.isKinematic = true; // Lifts parent block up for it to be noticed by players parentBlock.transform.Translate(Vector3.up * .15f); // Initializes parent block color to special block color Material[] materials = rend.materials; materials[0] = activeMaterial; rend.materials = materials; // Set Up Powerup based on choice of powerup assigned switch (choice) { case 0: chosenPower = powerup1; break; case 1: chosenPower = powerup2; break; case 2: chosenPower = powerup3; break; default: break; } setUpPowerUp(chosenPower); }