#How to prohibit the use of the
1 messages · Page 1 of 1 (latest)
When you say "prohibit the use" - isn't this just about making the method private? maybe I'm misunderstanding something
private means that the method will only be invocable from within the class that it's implemented
hey
when I hold the object in my hand and look at the rack and press the button, the method works.
I want to prohibit this action
@thick rover
okay, so it doesn't sound like a matter of syntax - it sounds like you want the action to be prohibited from a game logic standpoint?
As in, you want the player to be prohibitted from performing that action within the game?
yes, if the player has an object in his hand
what's the difference between isCarrying and hasCarriedItem?
is it possible that you have two variables for the same thing, and you've set one of them to true, but you're expecting the other one to be true?
maybe I'm just confused myself.
because, otherwise, I think that's all there is to it - if the user being able to carry something is conditional, set that condition in a variable and check if that condition is met when the user is trying to check something
(and you can check that within the function, or check it before you let the function be called - I don't know that one of those implementations is better than the other
if you find yourself in a situation like this, it's good to check if the condition you're expecting to be true is actually true, with a Debug.Log statement
because now you don't have a condition preventing the user from performing the action!
I didn't have it before, but now I need to write a condition that prohibits it.
you previously had something like:
if (hasCarriedItem){
...
}
I checked it out, it wasn't even working.
I think it wasn't working because of this #1292258863889911838 message
about what?
I linked it