|
Post by isaiasgamedev on Sept 20, 2021 18:59:37 GMT
How do I create trees, rocks, blockers? What would it be like to create a lake where specific classes could use and land where there is a disadvantage for a type of vomiting, for example, a sand area where units that walk, walk at half the movement value, a region where flyers suffer the even and where teleporters cannot teleport? How to create tiles that are traps? could anyone help me with these ideas? I want to add this to the boardcreator script so I can create nicer maps
|
|
|
Post by Admin on Sept 21, 2021 13:28:37 GMT
Decoration: To create trees, rocks, and blockers... assuming all are non-traversable decorations, one option would be to just create a new gameobject, then add your decorations as children objects, and save the object as a prefab. The "LevelData" ScriptableObject could add another field which could be the name of your prefab, which you then load from resources when the level loads.
Terrain Types: Probably the easiest option would be to update the definition of a Tile so it includes some sort of enum that indicates the type of terrain that the tile is made up of, though another option would be to add some sort of component to the Tile GameObject that handles terrain related code. Either way, you would need to add another structure to the "LevelData" ScriptableObject to track all of this so it can be loaded again later.
During navigation, in much the same way as we check whether a unit can traverse a path given a jump height, we could just add additional checks when updating the movement cost based on the type of unit and the type of terrain so that some terrains cost more to cross.
If you want to block tiles from flyers or teleporters, it could be a similar solution, such as another mask enum that says what kinds of movement are allowed.
Traps: Traps may be the greatest challenge of the bunch, because I dont currently have anything in place to interrupt the traversal sequence, but at least you can see that I animate from tile to tile, and you essentially need to add a check before starting the tween to each new tile in the path. Make sure that there are no traps at the current tweened location, and if there are, abort the path and apply the result in some sort of new game state.
|
|