Hello there, I was just asking how do i make a in-game menu like i made a ATM in 3DS Max so when you walk up to it and maybe press E i want a menu to come up or if you don’t have a credit card in your inventory it will say: Invaild Credit Card or something…That also means i am asking how to make an inventory. Please help!
Thank’s in advance.
Nobody wants to have to press the “E” key. Make a texture map with every possible screen for the ATM, and have a box collider where the buttons on the picture of the ATM’s screen are, and they click on the box collider (do a screen point to ray raycast) and it calls a function.
Or if no interaction with the ATM screen is really needed, just have a trigger collider in front of the ATM and if they walk up to it with the card in their inventory, play the “stick it in and get the cash out” animation, if not, do nothing.
For your purposes, the inventory could just be a List.< GameObject >.
You can use List.Contains() to see if the ATM card is in it.
This is a little complex, but for the walk up part, you would use colliders and when you enter the collider, something (whatever you want) happens.
function OnTriggerEnter (other : Collider){
//Stuff
}
and for the “Invalid Credit Card” message, you could write in “function OnTriggerEnter” to display GUI text somewhere on the screen saying that, if you press down a button or something while in the collider.
So, something like…
function OnTriggerEnter (other : Collider){
If(Input.GetKeyDown("Any Key"))
{
//something here
}
}