Enabling a user to obtain a home
The process of making a user the owner of a property is very simple, partly because we have already acquired knowledge that will provide the fundamentals to do so.
We will divide the objective into the following sections:
- Adding a trigger to the Prefab of a house
- Programming the script that allows us to acquire the house
- Linking the house to a player
To start with this task, we will make modifications on the Prefabs that we have used to build the houses in the World1 scene.
Adding a trigger to the Prefab of the house
If you remember from Chapter 5, Preparing a New World for Travel, we added two Prefabs that represent houses in a scene; these Prefabs are located in the Resources
folder:
- Go to the Assets | Resources | Prefabs | Buildings path and double-click on the Suburb House Grey Prefab to edit it.
- Once opened, we will create a Cube and disable the Mesh Renderer component; we will only use its Collider to...