Game Development Reference
In-Depth Information
61.
62.
}
63.
}
64.
}
65.}
Listing 34: Holder script
The idea of the script is simple: when the player presses E key, we make sure that there
is no object in hand. If this is true, we try to find a suitable object to hold. If such object
is found, the holder holds it. On the other hand, if there is already an object in hand, this
object is released. The variable objectInHand stores the object that is currently hold. If the
value of this variable is null , it means that no object is in hand (line 19).
Search WWH ::




Custom Search