Here is the beginning scene.
When the player walks up to the object, all they have to do is click the object and it rotates to another position.
Each time the player clicks it will change its rotation, the player can do this until it is at the right rotation for them to continue on through the level.
Here is another screenshot of another rotation.
Here is a screenshot of the object behind rotating as well. This script can now be applied to any object that we would like to be able to be rotated.
This code above is the OnMouseRotate script. When the player clicks the left mouse button down, the object will rotate to a 90degree angle. In the Unity Inspector we can choose which angle we would like to be the right angle for the puzzle. Once the player has rotated the object to the right angle, the code then has a target reached function.
This screenshot above is the puzzle complete code. This works in conjunction with the OnMouseRotate script. So that when all of the objects have reached their target rotation, the puzzle will then be completed. We are hoping to have this puzzle work so that once it is complete it will then open the door for the player to escape.
Definitely going to be helpful, especially when altering the level will take place.
ReplyDelete