Tips / Best practices for customizing Selector behvior
Posted: Mon Dec 15, 2014 11:16 am
I am making a 2D top-down game similar to an SNES RPG like Chrono Trigger or Secret of Mana. Before purchasing DS, I had written my own "select/use" code using an abstract "Interactable" class, and an Interaction component on my player that uses raycasts to check in front of the player for Interactable objects, to achieve that old RPG style of walking up to NPCs and objects. I purchased DS for the dialog writing / database / etc, and didn't even know about the Selector features until recently.
I was wondering if you could advise on how to best integrate DS into my game. I don't mind rewriting or even tossing my stuff. Some things that come to mind (but I'm open to anything you'd advise): Should I just hand-send "OnUse" messages from my own scripts? Are there similar Selector messages I should just hand-send, for mouse-over and whatnot? Or is there a Selector base class I could / should subclass to make my own?
Another aspect of this is having a Selector (or whatever I end up using) perform some action before actually sending the OnUse message, or having a Trigger wait to complete an action before starting the conversation. Ideally, I'd like to (maybe in a coroutine?) be able to pathfind to the Usable/Interactable object and THEN start the dialog. The reason is I am supporting both controller movement (JRPG style, as stated above) and mouse/click movement for PC/Tablet - so I'll need Selecting to be based on both my own raycast code (or similar) and mouse selection.
Note that a proximity sensor doesn't help since I need to also consider which way my character is facing, and since it is a 2D game, I am swapping sprites rather than rotating my game object - so I think I do have to do this by hand with the raycasts.
Thanks again for the help! =)
I was wondering if you could advise on how to best integrate DS into my game. I don't mind rewriting or even tossing my stuff. Some things that come to mind (but I'm open to anything you'd advise): Should I just hand-send "OnUse" messages from my own scripts? Are there similar Selector messages I should just hand-send, for mouse-over and whatnot? Or is there a Selector base class I could / should subclass to make my own?
Another aspect of this is having a Selector (or whatever I end up using) perform some action before actually sending the OnUse message, or having a Trigger wait to complete an action before starting the conversation. Ideally, I'd like to (maybe in a coroutine?) be able to pathfind to the Usable/Interactable object and THEN start the dialog. The reason is I am supporting both controller movement (JRPG style, as stated above) and mouse/click movement for PC/Tablet - so I'll need Selecting to be based on both my own raycast code (or similar) and mouse selection.
Note that a proximity sensor doesn't help since I need to also consider which way my character is facing, and since it is a 2D game, I am swapping sprites rather than rotating my game object - so I think I do have to do this by hand with the raycasts.
Thanks again for the help! =)