/// <summary> /// Matches the rotation of the Block to the rotation of the colliding Block. Sets the WasReMatchedWithBlock Flag to true to indicate that /// it is now in line with the colliding Block, so that the other Blocks in the Structure can use this Block to rotate themself. /// </summary> /// <param name="currentCollisionObjects"></param> /// <param name="connectedOn"></param> public void MatchRotationWithCollidingBlock(List <CollisionObject> currentCollisionObjects, OTHER_BLOCK_IS_CONNECTED_ON connectedOn) { if (currentCollisionObjects.Count > 1) { //Send message to Blocks in Structure to set them to kinematic for rotation blockCommunication.SendMessageToConnectedBlocks("SetKinematic"); //Rotate the Block GetComponent <BlockRotator>().RotateBlock(currentCollisionObjects, connectedOn); //Set flag that Block was rotated WasReMatchedWithBlock = true; //Send Message to Blocks in Structure to ReMatch their rotation in line with a Block that has //already rotated blockCommunication.SendMessageToConnectedBlocksBFS("ReMatchConnectedBlock"); //Tell Blocks in Structure to add themself to the History blockCommunication.SendMessageToConnectedBlocks("OnAttachToFloor"); //Check which additional Groove or Taps were hit after Rotating StartCoroutine(EvaluateColliderAfterMatching()); } }
/// <summary> /// Called when the Block is attached to the Hand /// </summary> /// <param name="hand">The Hand the Block was attached to</param> public void OnAttachedToHand(Hand hand) { holdingHand = hand; //Send Message to all connected Blocks that the Structure was picked up blockCommunication.SendMessageToConnectedBlocks("OnIndirectAttachedtoHand"); }