![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
4:54pm - I'm down at the McDonalds again. I wasn't sure about coming here but I'm glad I did. I don't think I'd have been able to do the work I need to do at home today, and by the way my body felt on the way over here I really needed the exercise.
Anyways today I try to make a GameEvent trigger a dialogue. I'm not 100% sure how I want that to happen though. Should it be triggered through the PlayManager or the DialogueManager? It requires changing the game state to Dialogue, and back again afterwards, so it'll need to talk to the PlayManager anyways. It'll also need to know what state it was in beforehand so it can go back to it after the dialogue completes. So that's a concern. With those concerns I would say PlayManager, but it's also possible that it could call the DialogueManager and the DialogueManager calls the PlayManager in its process of activating Dialogue mode. The tricky thing is that I'm not sure how to send a note along with the Event that says what dialogue to start.
This is really bugging me for a couple reasons. The big one on my mind is that I still haven't dealt with the problem of using external XML files for the dialogue. I wanted them wrapped into the game. Of course the Dialogue Demo only used the one XML file for the one dialogue it had, so it didn't have to worry about things like this dialogue or that dialogue until now.
I'm going to look at the Dialogue system as I wrote it before and see how I might fix it.
5:15pm - Found a Future Squirrel's Problem; the DialogueManager caches a reference to the MainUI canvas but has no way of finding it again after a scene transfer. I can either set it to Don't Destroy On Load and bring it with me, or cache a new one on every load. :/
Hmm... I don't want it coming with me into combat scenes or the main menu. I'd better do the re-cache method.
5:21pm - Huh, looks like I just have to move it from Start to Awake; which gets called on every object in the scene on scene load.
5:37pm - I was just looking into how to read XML files with Unity and found a couple other ways besides the one I had been using. I had been using the .NET streams to open the file directly, and remotely, and that's not what I want. The other two methods I just found are different. The first is to put the XML file into a resources folder and use the Resources class to access it. But reading the documentation for the Resources Class gave me another idea. I could make an XMLHolder object that holds an XML dialogue in a hard reference! I'm not 100% sure it'll work so I'm going to try it, first. But the idea here would be that the player would trigger a DialogueEvent on an NPC or object instead of a GameEvent, and the DialogueEvent would have a hard reference to the script.
My brain's kinda burning from all this. Hopefully I'm not doing any damage. XD
6:43pm - Just to keep on track of what I'm currently doing, I'm trying to make a StartDialogue function and redoing the XML parsing. But, the way it was done before was with a stream from a file. I'm trying to figure out how to do it reading from a string, since that's what I've got, a great big string containing the contents of the file.
7:24pm - Okay I think I've got the code set up correctly to read from the XML file hard referenced by the DialogueEvent. I just need to make the DialogueEvent call the DialogueManager's start function passing its TextAsset reference as a parameter.
But before I can test any of this I also have to make it so that the player can trigger the DialogueEvent. XD
So I'm not done yet but making a lot of progress on a complex intertwining of systems. I just hope my code isn't too Spaghetti...
8:09pm - I did some more work and took a short break to look for events and things in Royal Oak, MI, since I'm planning to visit there soon. Not much going on though.
8:23pm - Finally I'm working on getting the code in place to interact with objects. I'm putting it in the MobileController, so any mobile that is being controlled can interact with objects. The tricky part is figuring out the player's facing.
Okay I'll do it by using the movement value. I'll store it in the class when it's changed and I'll raycast in that direction to find what the player is trying to interact with. Or probably not 'ray' but 'circle' or 'box'. Let me check my raycast toolkit...
9:24pm - Well it works but it's buggy. It doesn't like it when I try to talk to nothing, and there are issues with using physics on things.
Anyways I'm going to pack up and go home; fix the bugs another time I think. Toodleoodleoodleoo.
Anyways today I try to make a GameEvent trigger a dialogue. I'm not 100% sure how I want that to happen though. Should it be triggered through the PlayManager or the DialogueManager? It requires changing the game state to Dialogue, and back again afterwards, so it'll need to talk to the PlayManager anyways. It'll also need to know what state it was in beforehand so it can go back to it after the dialogue completes. So that's a concern. With those concerns I would say PlayManager, but it's also possible that it could call the DialogueManager and the DialogueManager calls the PlayManager in its process of activating Dialogue mode. The tricky thing is that I'm not sure how to send a note along with the Event that says what dialogue to start.
This is really bugging me for a couple reasons. The big one on my mind is that I still haven't dealt with the problem of using external XML files for the dialogue. I wanted them wrapped into the game. Of course the Dialogue Demo only used the one XML file for the one dialogue it had, so it didn't have to worry about things like this dialogue or that dialogue until now.
I'm going to look at the Dialogue system as I wrote it before and see how I might fix it.
5:15pm - Found a Future Squirrel's Problem; the DialogueManager caches a reference to the MainUI canvas but has no way of finding it again after a scene transfer. I can either set it to Don't Destroy On Load and bring it with me, or cache a new one on every load. :/
Hmm... I don't want it coming with me into combat scenes or the main menu. I'd better do the re-cache method.
5:21pm - Huh, looks like I just have to move it from Start to Awake; which gets called on every object in the scene on scene load.
5:37pm - I was just looking into how to read XML files with Unity and found a couple other ways besides the one I had been using. I had been using the .NET streams to open the file directly, and remotely, and that's not what I want. The other two methods I just found are different. The first is to put the XML file into a resources folder and use the Resources class to access it. But reading the documentation for the Resources Class gave me another idea. I could make an XMLHolder object that holds an XML dialogue in a hard reference! I'm not 100% sure it'll work so I'm going to try it, first. But the idea here would be that the player would trigger a DialogueEvent on an NPC or object instead of a GameEvent, and the DialogueEvent would have a hard reference to the script.
My brain's kinda burning from all this. Hopefully I'm not doing any damage. XD
6:43pm - Just to keep on track of what I'm currently doing, I'm trying to make a StartDialogue function and redoing the XML parsing. But, the way it was done before was with a stream from a file. I'm trying to figure out how to do it reading from a string, since that's what I've got, a great big string containing the contents of the file.
7:24pm - Okay I think I've got the code set up correctly to read from the XML file hard referenced by the DialogueEvent. I just need to make the DialogueEvent call the DialogueManager's start function passing its TextAsset reference as a parameter.
But before I can test any of this I also have to make it so that the player can trigger the DialogueEvent. XD
So I'm not done yet but making a lot of progress on a complex intertwining of systems. I just hope my code isn't too Spaghetti...
8:09pm - I did some more work and took a short break to look for events and things in Royal Oak, MI, since I'm planning to visit there soon. Not much going on though.
8:23pm - Finally I'm working on getting the code in place to interact with objects. I'm putting it in the MobileController, so any mobile that is being controlled can interact with objects. The tricky part is figuring out the player's facing.
Okay I'll do it by using the movement value. I'll store it in the class when it's changed and I'll raycast in that direction to find what the player is trying to interact with. Or probably not 'ray' but 'circle' or 'box'. Let me check my raycast toolkit...
9:24pm - Well it works but it's buggy. It doesn't like it when I try to talk to nothing, and there are issues with using physics on things.
Anyways I'm going to pack up and go home; fix the bugs another time I think. Toodleoodleoodleoo.