I have a script where it switches between 5 weapons, with the press of a button. In my game, you have a typical hotbar, with 5 slots, and yous witch between them. When they walk up to a specific object, I want an inventory screen to pop up, along with every weapon they have. They can then drag and drop the weapons into they're hot bar. So, here's my question; What's the best way to do this? I was thinking maybe I could have a script with all of my guns in it, and when you press "up" it moves you up, to the nearest weapon on the array that is also in your hotbar. But, I have no clue how to do this. If any one has made a system similar to this, or just has an idea for making it simpler, it would be greatly appreciated, because at this point I'm just a little lost.
I would have a weapons mng, then as sub mngs or delegates, each weapon. You could have your pause btn, or open weapons HUD btn, trigger a function in the weapons mng, to open the HUD (weapons selection). Once open, this HUD, (ps... Opening can be via scale, or positioning) the HUD contains 5 bans, one for each weapon. If weapon x btn pressed, this btn, can trigger a function in weapon x script (a delegate or sub mng of the weapons mng). This function will inform the weapons mng to swap weapons from current weapon to this weapon. From there, it's a matter of setting the new, current weapon to active and then deactivating the old, current weapon. Activation, could be done via a book, or a collider as a btn what have you.