Hi,
I have 4 kinds of object. Imagine they are mirrors and they must reflect the sun rays in proper way.
I create 4 hotspot for each object. Each hotspot can rotate the objects 90 degree on click. They are working perfect.
After the player adjust them on correct way, the door should be open, or something will happen.
So I need a script something like which says "if object 1 (90), if object 2 (180), if object 3 (270), if object 4 (0) degree, start bla bla"
So I think I need to create variables, but I couldnt find how to. There is not so much info about variables and how to use.
I dont know Unity so much, maybe its something easy without using AC, I am open for every idea.
Can anyone help me?
Comments
But I am still wondering, if there is anyway in AC itself with variables.
What you can do is create a Boolean variable that acts as a "solved" check. The script will update this variable manually, and the Variable can then be used in Actions to act accordingly.
First, create a Bool variable in the Variables Manager. I'd suggest creating a Local variable, since these objects all appear in the same scene. Rename it to RotationIsCorrect, set it's Initial value to False, and take a note of it's ID value (the number to the left of the colon in the list of buttons). We'll use this number in the script.
Adapting your supplied script, remove the Update function and replace with this:
void CheckSolution ()
else
{
LocalVariables.SetBooleanValue (1, false);
}
This sets the Local boolean of ID 1 (replace the 1 with your own ID number) to either true or false, depending on whether or not the puzzle is solved.
When we want to see if the puzzle is solved or not, we need to call this function, and then use the Variable: Check Action to look at the boolean's state.
To call this function, use the Object: Send message Action, set the Object to affect as the object with your custom script attached, and set the Message to send to Custom, and the Method name to CheckSolution. This will cause our function to be called, and the local variable will be updated.
Next, use the Variable: Check Action - setting the Source to Local will let you select your boolean from the popup box. As for what happens if the solution is correct / false, it helps to view this actionlist within the ActionList Editor window, available from the top Unity toolbar under Adventure Creator -> Editors.