Dynamic Camera, Joining the Game, and Reset
|
The work week that was 1-5 May mostly consisted of work tasks of not very big size, so I’ll detail a few, but not all, of the things I did instead of just one task per post as I did previously. One of the things i made then was a dynamic camera. It zooms in on the character that is currently doing their action. The camera zooms out to show everyone while the players plan their turns. The camera is positioned right in the middle of the two characters that are furthest away, and the distance how far away from the room is determined by how far away those two characters are. The transitioning of the camera smooths in when switching what the camera focuses on. The camera only moves to entities that have their “doFocus” variable boolean set to true. Another thing I made that week was to have the game start start when all three players have connected to the server and have chosen character, and also disallowing more players from joining the game. I made it so the game could be started regardless of the number of players by pressing the ‘s’ key, so it would be easier for us to test the game. I also made the game server to disallow multiple players from choosing the same character. I made it so the game can be reset by holding the ‘r’ key for three seconds on the server. The clients are also made to do a proper reset if they get disconnected from the server. Game objects that are set to not to be destroyed on scene change by using DontDestroyOnLoad are changed to use my DontDestroy wrapper, which adds the game object to a pool. All the game objects in the pool is destroyed when the game is reset. During the reset the entities are destroyed and the NetworkServer is reset, and finally the main menu is loaded. |