#Blog 15 Collection
Every day in my game a boat will come to the dock and request items, if the player delivers items before the boat arrives at the dock then their guardian boat will start to build. Each day that the required items have been deposited in the collection check on arrival of the boat, the guardian boat will start to phase in more over time. If the player doesn’t deliver the collection boats requirements on time however then they will be taken back two days worth of increments on the guardian boats building.
Collection Chest
I created a chest that the player would have to deposit the right amount of items in before the collection boat arrives to increase the guardian boats state before they are able to get of the island. To make this chest work I had to define what items would be required each day. To do this I created a system that would randomly select a pre-defined list of items that would be required for that day.
Chose what items to collect
This event sets the all collected bool to false and resets all others to false aswell. Doing this it then runs a random int between 0-3 which defines what items will be required on that day. There are 4 sets for it to chose from, these being Fish, Vegetables, Fruit and Resources.
Displaying the UI
Because there are 4 separate UI for each pre defined set, when the system is chosing a set it also defines which of the 4 UI to display for that set. Appart from that I am using the same display techinique used from previous systems like the bonfire for example.
Setting Amounts
Event though the sets are predefined the amount of each item is not, set an array of items to the respective sets list, this lets me randomly set those integers values to a random amount between 1-10. I have 4 of these one for each pre-defined list.
Check If Collected
Once the boat arrives it needs to know if the items have been collected by the chest or not. For this it’s a simple integer check for each of the variables for that days pre-determined list, if they are equal to 0 then the player has deposited all the right items and the “All collected” bool can be set to true.
UI
I am using a similar system to that of the bonfire, 4 icons display the required items and the numbers underneath display the amount of that item that is required. The deposit button checks to see if the custom game-mode has enough each required item to deposit. If it is true then it decreases the game mode’s amount of that item by the chests amount for those items. After this it them sets the chests pre-determined list variables to 0 and set the all collected bool to true.
Collection Boat
The collection Boat Starts at the far away island and slowly move towards the island that the player is on using a timeline to move, this only occurs during 10am-12pm. Once the move towards the player island timeline is complete it calls to the chest and checks to see if the all collected bool is true, if it is then it increases the guardian boats phase/visibility amount before calling the chest to chose another set of items to require then it reverses back to the distant island.
Guardian Boat
The guardian boat slowly phases into the game as the player keeps increasing the the total amount on the boat by giving the required items to the collection boat. This is the players only way off the island.
Increasing/Decreasing the boats opacity
When the player increases the amount required to complete the boat the opacity of the material on the boat increases, the player isn't able to step onto the boat until the total amount is equal to 50 however so it takes a while for it to be ready.
Check the total amount
This runs every 5 seconds to check to see if the total amount is equal to 50 and if it is then it sets the material of the boat to completion and sets the boats collision to true.
Increasing/Decreasing the total Amount
Everyday the collection boat arrives it will either increase or decrease the total amount on the guardian boat depending on whether or not the player has deposited the required amount of items to the collection chest. If they have then it will increase the amount by 1 but if they didn’t then it will lower it by -2 so the player really needs to keep on top of the collection or else they will never get of the island.














