Before following this tutorial module, make sure that you are:
Either starting with "Barebones Game" Loaded into the Editor,
Or starting from your saved copy of your Game that you used while following the other modules of this tutorial.
Initial Preparation[ | ]
First, in your Project Hierarchy, find "Gameplay/Win Trigger" and Right-click to delete it. This is the old trigger that governs the win condition of the game that you started with. We'll be recreating the Win Trigger that the "Barebones Game" uses by default (collecting the Golden Pineapple) from the ground up. Yes, this means if you started with the "Barebones Game" for this tutorial, you just deleted the exact same thing we'll ultimately be making. Don't think about it too hard... The point is, we need to delete this Asset from our Project Hierarchy so it doesn't conflict with our new work.
Right-click on the Gameplay entity in your Project Hierarchy and select "Create Empty" from the dropdown that appears, rename to “Win Pineapple”. Search for “Trigger” in the Library, and drag and drop the “TriggerVolume” Script onto the “Win Pineapple” entity you just made.
Setting Up The Pickup's Visuals[ | ]
Search for "pineapple" in the Library.
From the Library, drag "Golden Pineapple Visuals" to your existing "Win Pineapple" in the Project Hierarchy. This will make the visuals a child of the trigger.
With "Golden Pineapple Visuals" still selected, make sure its Properties Panel is visible:
Numerically set Rotation X to -90.
Numerically set Scale to 0.2, 0.2, 0.2.
Now, in your Viewport, move "Win Pineapple" and nudge its position so that it sits nicely on the rooftop. Both the Pineapple and the Trigger Volume should move together.
Final Pickup Configuration[ | ]
Make sure "Win Pineapple" is selected and its Properties Panel is visible.
In the Properties, click the "+" on the "Trigger Enter" field to expand it and make "Target" field visible.
Then, from your Project Hierarchy: Drag "Gameplay/ GameplayLogic" to the "Target" field of "Win Pineapple".
Finally, click on the "No Function" drop down right under it, and select "PlayerWon()". This will make it so that when you touch the pickup, you will win the game.
Now is a good time to press Play and test everything.
Make sure your Avatar is positioned in a good starting place, and the Tower is also in a good position for gameplay.
Congratulations! You have completed this tutorial and now have the knowledge to create a simple Game.