Hi Chris & community,
I have started playing the *latest* masterpiece of Ron Gilbert, Thimbleweed Park, and I noticed something I would like to have in my AC game as well.
I am talking about the "shake" effect on things, such as:
- dialog options on mouse-over, for a nice feedback
- inventory items, when non-examined, so that the user has a reminder to examine them
How could I reproduce these two effects? Do you think this will be coming with a future AC version?
Thanks & enjoy playing & making games!
Comments
Even somewhat simple animations in the menus are something that the OnGUI-based Adventure Creator menu system isn't really up to, but that's really what the intention is behind AC's Unity UI integration - to empower the user to add on such effects through custom scripts and events.
The ability to shake a UI Button could be done either through regular animation, or a fancy script-based solution, so the real issue is how to connect it to AC. For that, look to AC's Event system - see this tutorial if you're unfamiliar.
The event you'll want to hook up to is OnMouseOverMenu, which has parameters for the Menu, Menu Element, and slot number being hovered over by the mouse. You can use these parameters to work out if the user is currently hovering over, e.g. the 1st slot in your Conversation Menu's DialogList element, and animate it accordingly.
However as I said: the OnMouseOverMenu event provides a slot number index parameter - which will be 0 for the first option, 1 for the second, etc.
AC's built-in menu system is written with the assumption that all slots are drawn together, so it's not possible to do with that mode without some serious hacking. Using Unity UI for this should be trivial, though - just read the slot number and animate the appropriate UI Button.
I have, however, written a guide for an "unofficial" integration between the two on the AC wiki here: http://adventure-creator.wikia.com/wiki/Text_Mesh_Pro_integration
UnityEngine.UI.Button uiButton = AC.Serializer.returnComponent <UnityEngine.UI.Button> (uiButtonID);
where uiButtonID is the Constant ID number associated with the Button.