Can someone tell me how to make a weapon pickup script, to pick up weapons randomly on the map and later be able to switch them. I want to have a maximum of two guns you can switch(like in COD) and then resultly pick a new weapon up and replace with your gun you are holding. The thing is I have tried some many times to do this but I never came to a result. I would prefer C# since I am more familiar with it.
Thanks in advance
For picking up a weapon simply think like this:
- if someone touches this weapon
- ask the player if he wants to pick it up (GUI)
- if they say yes
- move the weapon to the player hand
For switching between them try thinking like this:
- when the player [link text][1] to switch weapons
- instantiate the respective primary or secondary weapon to the player.
No one is going to give you code like that, but what I said is how you should think about doing it.
I hope this helps, good luck!
[1]: http://unity3d.com/support/documentation/ScriptReference/Input.html 4. "pushes a certain button"