nicholas-maltbie / FallingParkour

Multiplayer racing game made with Unity
MIT License
18 stars 3 forks source link

Spectator Camera #18

Closed nicholas-maltbie closed 3 years ago

nicholas-maltbie commented 3 years ago

Description

Added a basic spectator camera and player into game flow

There is no auto end round when all players finish the level but it's what we have so far :)

How Has This Been Tested?

Tested locally on one and multiple clients to ensure spectator player works in the following cases

Checklist:

swiimii commented 3 years ago

I downloaded the branch and did some manual tests. The spectating itself feels good for a first iteration with one exception. When I press Shift to swap my spectator target, my target changes twice: once when I press shift, and once again when I release shift. This should probably be changed so the target changes only once per press.

nicholas-maltbie commented 3 years ago

Great comment, I will attempt to address the press and release of buttons via input system in unity 😄

Found a thread online about the topic: https://forum.unity.com/threads/how-would-you-handle-a-getbuttondown-situaiton-with-the-new-input-system.627184/

If all you're interested in is getting one call on press and one on release, hook into started and cancelled.

Code (CSharp):

myAction.started += /* button was pressed */;
myAction.cancelled += /* button was released */;

If you want to continuously be notified for as long as the button is held, check the "Continuous" box on the action and use performed and cancelled.

Code (CSharp):

myAction.performed += /* button was pressed or is held */;
myAction.cancelled += /* button was released */;

From Feb 19th, 2012 by Rene-Damm - https://forum.unity.com/threads/how-would-you-handle-a-getbuttondown-situaiton-with-the-new-input-system.627184/#post-4232515

There also seems to be more follow up discussion about the input system here - https://forum.unity.com/threads/how-would-you-handle-a-getbuttondown-situaiton-with-the-new-input-system.627184/#post-5379081 interesting to look into in the future for sure.