Planet Unknown: Torch Triggers
- Nov 15, 2020
- 1 min read
Due to parts of Planet Unknown taking place underground and our implementation of 2D lighting the player is equipped with a torch. We wanted the torch to enable and disable itself whenever the player entered or exited an underground area.
To do this I made a torch trigger prefab using a 2D collider and C# script that I wrote. Similar to the method I used for the world space tutorial HUD, the script use the entry and exit of the players collision with the collider to run code using a tweening function from David Flintofts utility code to tween the 2D point light's outer radius between values 0 and 1.8 to smoothly transition between the torches on and off mode. In engine two of these trigger boxes are place in each cave section, one at the entrance and one at the exit. The torch would be enabled upon entry and disabled upon exit.




Comments