This project is training project for the next part of Space Pirate which is going to be a tactical turnbased strategy game where I use hexagon tiles. This project is to test how to easily set up a custom grid and pathfind through it and game logic using the grid.
Is a simple game where you are trying to protect your base from an enemy attack by placing a set number of turrets along the route from the enemy base to your base. The goal is to hold them off long enough without taking to much damage.

Content
Grid
The playfield consists of blocks which has two script on them. The first is the Cube Editor which is an in editor script which make sure that you can only movet he blocks along a set grid. The second is the Waypoint script which holds the data for each block and is used to pathfind through the grid. The Waypoint contains the position of the block which also serves as the id for the block as well as a bolean to state if it has been explored used for the pathfinidng.
The pathfinindg uses a breadth first search algorithm to find a path. The path dosen’t change after being calculated onces and is then collected by enemys when they are spawned to know how to move to the player base. The waypoint also contains the bolean which states if is occupyed or not. This is used by the towers to make sure you can’t palce them ontop each other. In my game the enemy path also gets this bolean set so the player can’t block the enemies. The enemy path also changes colour to that of the enemy which in this instance is blue.
The breadth first algorihthm The creation of the grid The waypoint script The grid showing the blocks and the enemy pathway
Tower
The tower consists of a prefab containing three objects. Two make up the tower a bottom and a top. The top part is the thing that looks at the closest enemy. Each tower has a particle system which spawns the particle bullets that hit the enemy. The tower has range parameter you can tweek.
Tower public Tower update Tower waypoint influence Tower prefab
Enemy
The enemy is the opponent in the game and is something that is spawned from the enemy base at a set interval. Each enemy has stats conscerning its health and movement speed. When the get spawned they collect a path to take from the Pathfindinger script. They then use a corutine to move from block to block until they are either destroyed or reach the player base.
Enemy prefab Enemy damage script Enemy movement script
Base
The base in the game is where the player health variable is stored and get’s depleted through triggering an enemy collider. When an enemy reaches the collider the base takes damage equal to the enemy damage.
Friendly base
Showcase

Download
Press this link to download a zip file containing the game for windows PC.
https://drive.google.com/file/d/1gyVJMrtUryQPIUI12m3KI8zuWaicG_56/view?usp=sharing