Quick Start 1: Create a Global Wave & Add a Spawner
Before specifying what each Global Wave will spawn (enemies, power-ups, etc), you will need to set up at least one Global Wave. For Global Waves, you create one or more Levels, and each Level contains one or more Global Waves. The Global Wave specifies things like how many seconds it lasts (or whether it's an Elimination Wave), and can have zero or more Syncro Spawners that use it to spawn things.
- To begin, create a new Unity project and import Core GameKit. Then create a new empty Scene.
First, we will need the main Game Object LevelWaveSettings. Find it in Project View, in
Assets/Plugins/DarkTonic/CoreGameKit/Prefabs. Do not drag it into the Scene or you risk losing your data the next time you update CoreGameKit - unless you manually "break the prefab connection". Instead, click the "Create LevelWaveSettings Game Object" button in the Inspector, shown below. Note that if you are on Unity 2018.3 or newer, you may not see this depending on the version of Unity. If it looks different, just drag the prefab into the Scene to create a copy of it.
Now, select the LevelWaveSettings Game Object you just created in the Hierarchy. There's an additional step to perform - you must create a prefab (and break away from the original prefab) out it by dragging it into the Project View where you want the prefab to live, then the warning will go away. Once you have, it will look like this:
You will need to check the "Use Global Waves" checkbox near the top so that Global Waves are used. Now click "Collapse All Sections", then expand the "Levels & Waves" section (2nd from the bottom). That will look like this:
You start with no Levels, as the Inspector says, so go ahead and click "Add" to create the first Level, which will start with one Global Wave in it. With the Wave now there, it will look like this:
- Notice that the Wave has a Duration of 5 seconds. That means that it will advance to the next Wave after 5 seconds. Change that to 10 seconds. Since there are no more Waves, the player will "win" and Game Over will be set to "true" when they beat the last Wave. You can read more about that on the Level Wave Settings page.
Now we have a Global Wave set up, but there are no Spawners using it, so nothing will spawn. We also haven't created any Spawners so we can't add them from the dropdown there labeled "Add Wave For Spawner". So let's create a Spawner now. Collapse the Levels & Waves section and expand the Syncro Spawners section. It will look like this:
Choose the name "Spawner1" and click "Create Spawner". You will see a green shape representing the Spawner in Scene and Game View. Go ahead and click the gear icon for the Spawner row that appears underneath the button you just clicked. That will select the Spawner in the Hierarchy.
You can move the Spawner to a different position in the Scene if you like, now that you've selected it. Now let's go back to the Levels & Waves section to add a Spawner Wave (yes you can do it on the Spawner Game Object but I want to show another way).
- Click the Core GameKit logo up top in the Inspector to navigate back to LevelWaveSettings.
- Click "Collapse All Sections" again, then expand "Levels & Waves".
- Now select your Spawner from the "Add Wave To Spawner" dropdown in the Wave 1 section, and it will create a Wave in the Spawner set to Level 1, Wave 1. If you added it in the Spawner, you'd have to select the Level and Wave it is for so this is usually a little quicker.
- A row for the Spawner will show up just below that. Go ahead and click the gear icon to go to the Spawner again.
Your Spawner has the correct setting (Level # 1, Wave # 1), but you need to tell it *what* to spawn, how many and for how long. The Inspector now looks like this:
It's set to spawn a random number between 1 and 2 over 3 seconds, immediately when the Global Wave starts (immediately because Delay Wave is set to 0 seconds). Let's change that a random number between 20 and 30, over 9.9 seconds (Time To Spawn All must be less than the Global Wave duration which is 10 seconds).
- Set Min To Spawn to 20.
- Set Max To Spawn to 30.
- Set Time To Spawn All to 9.9.
- Now you just need to populate the empty "Prefab To Spawn" field and you're ready to go. Go ahead and create a prefab of a Cube, then return to this Inspector and drag that prefab into the "Prefab To Spawn" field. The red error message will disappear.
However, you're not quite done yet. Another warning will pop up telling you that the Cube is not configured in Pool Boss. All prefabs must be configured in Pool Boss to ensure rock solid performance - it's an object pooler. That warning box looks like this and will let you fix this without leaving this Inspector!
- As long as you have the Category you want in the dropdown (and that's why I suggest first creating your Categories under the Pool Boss Game Object first before starting anything else), pick a good Preload Quantity and click "Create Pool Boss Item". Since our Spawner Wave will spawn up to 30, let's preload 30. Now the warning box will disappear.
Let's go back to LevelWaveSettings. Click on the Core GameKit logo again to go there. Now press play to watch the Global Wave (actually the Spawner Wave) spawn. They will all spawn in exactly the same position so it will be hard to tell from Game View that new ones are spawning, but the Hierarchy and Scene View will confirm it. We will explore some Spawner options soon to change this. Notice in the Inspector there is a "Game Status Panel" that shows the current Global Wave and seconds remaining. It will change to "Game Over" when the Wave ends.
That's it for this Quick Start!