Skip to content

Commit

Permalink
wip more
Browse files Browse the repository at this point in the history
  • Loading branch information
toberge committed Jul 12, 2024
1 parent c630a17 commit 5806127
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Assets/Scripts/Control&Input/OrbitCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ public class OrbitCamera : MonoBehaviour
private Transform cameraTransform;
private new Camera camera;

private LayerMask previousCullingMask;

public Camera Camera
{
set
{
camera = value;
previousCullingMask = camera.cullingMask;
camera.cullingMask = cullingMask | (1 << (12 + player.LayerIndex));
cameraTransform = value.transform;
}
Expand Down Expand Up @@ -71,6 +74,7 @@ public void Deactivate()
{
StopTracking();
StopCoroutine(trackingRoutine);
camera.cullingMask = previousCullingMask;
}

private IEnumerator WaitAndStopTrackingRagdoll()
Expand Down
26 changes: 26 additions & 0 deletions Assets/Scripts/Gamestate/PlayerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,32 @@ public virtual void Respawn(Transform spawnpoint)

transform.position = spawnpoint.position;
transform.rotation = spawnpoint.rotation;

playerIK.transform.localPosition = Vector3.zero;
playerIK.transform.localRotation = Quaternion.identity;
//inputManager.transform.position = Vector3.zero;
//inputManager.transform.localPosition = Vector3.zero;
inputManager.transform.rotation = Quaternion.identity;
inputManager.PlayerCamera.transform.rotation = Quaternion.identity;
GetComponent<Rigidbody>().position = spawnpoint.position;
GetComponent<PlayerMovement>().SetInitialRotation(spawnpoint.rotation.eulerAngles.y);

hudController.DisplayHUD();

SetPlayerInput(inputManager);

StartCoroutine(SetTransformAfterRespawn(spawnpoint));
}

private IEnumerator SetTransformAfterRespawn(Transform spawnpoint)
{
yield return null;

//playerIK.transform.localPosition = Vector3.zero;
//inputManager.transform.parent.position = Vector3.zero;
//inputManager.transform.parent.localPosition = Vector3.zero;
//inputManager.transform.parent.rotation = Quaternion.identity;
//inputManager.PlayerCamera.transform.rotation = Quaternion.identity;
GetComponent<Rigidbody>().position = spawnpoint.position;
GetComponent<PlayerMovement>().SetInitialRotation(spawnpoint.rotation.eulerAngles.y);
}
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/UI/PlayerHUDController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ public void DisplaySpectatorScreen(PlayerIdentity target)
spectatorTargetText.color = target.color;
}

public void DisplayHUD()
{
deathScreen.SetActive(false);
spectatorScreen.SetActive(false);
ammoHud.parent.gameObject.SetActive(true);
speedLines.gameObject.SetActive(true);
}

// x and y expected to be in range [-1, 1]
public void MoveCrosshair(float x, float y)
{
Expand Down

0 comments on commit 5806127

Please sign in to comment.