Pickup Collection made easier.
Since we have given some Enemies the ability to destroy the Players Pickups, it is only fair, we make collecting them easier for the Player. To this end, let’s make it so that if the Player is within 6m of a pickup and presses the C key, the pickup will move to the Player at a quicker rate.
To accomplish this, we need to add the following code to the Update method of the Powerup script:
We, of course, need to add the variable:
And make reference to it in the Start method. We also need to add the following after the if statement:
Then, running game will give: