New-ish, to godot and C#. I'm wondering what some good methods would be for sharing data (i.e ammo count) between held and dropped weapons, assuming that the held and dropped are two separate scenes, but somehow ensuring that they are associated.
Some basic background info, there will only be five weapon types in total and it would be preferable if each weapon(refering to both the world model/viewmodel) were permanently associated for log keeping purposes. There may be many instances of the world model weapons laying around.
I suppose this is sort of a data structure/node tree question. But basically, I want to have a standardized data table of some type that would be constant between the two, but I'm not aware of all possibilities for doing this. The main things that need sharing is the ammo count, and the ID. Gun wear might also come later.
To list some of my ideas for approaching this:
-
Just have identical scripts between the world model and the view model, no overarching system and then just synchronize the variables when instantiating/deleting during a pickup or drop process.
-
When a worldmodel gun is instantiated, also instantiate a "GunData node" in parrallel which then acts as the central identity of the gun, which both the view model and worldmodel pull from.
-
Some sort of extension/inheritance relationship either between the scripts of the guns, or the scenes themselves. I can think of a few ways of doing this, but I don't know which or if any of them would be considered the "proper" way.