From 1e5c6393a6b29eb00dbb8fb137d86647cb0c356b Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Fri, 28 Jul 2023 22:06:03 +0100 Subject: Add TryUnstuck and death overlay --- code/pawn/PlayerSpectator.cs | 48 -------------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 code/pawn/PlayerSpectator.cs (limited to 'code/pawn/PlayerSpectator.cs') diff --git a/code/pawn/PlayerSpectator.cs b/code/pawn/PlayerSpectator.cs deleted file mode 100644 index c468de0..0000000 --- a/code/pawn/PlayerSpectator.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Sandbox; -using System.Collections.Generic; -using System.Linq; - -namespace MurderGame; - -public class PlayerSpectator : EntityComponent -{ - public Player Target { get; set; } - - public void Simulate() - { - if (Target == null || !Target.IsValid() || Target.LifeState == LifeState.Dead) - { - var targets = GetTargets(); - if ( targets.Count == 0 ) - { - Target = null; - return; - } - var nextTarget = targets.First(); - Target = (Player)nextTarget.Pawn; - } - } - - public void FrameSimulate( Player player ) - { - if ( Target == null || !Target.IsValid() || Target.LifeState == LifeState.Dead ) return; - - // SimulateRotation(player); - Camera.Rotation = Target.EyeRotation; - Camera.FieldOfView = Screen.CreateVerticalFieldOfView( Game.Preferences.FieldOfView ); - - Camera.FirstPersonViewer = Target; - Camera.Position = Target.EyePosition; - } - - protected void SimulateRotation(Player player) - { - player.EyeRotation = Target.ViewAngles.ToRotation(); - player.Rotation = Target.ViewAngles.WithPitch( 0f ).ToRotation(); - } - - public List GetTargets() - { - return Game.Clients.Where(c => c.Pawn is Player player && player.CurrentTeam != Team.Spectator && player.LifeState == LifeState.Alive).ToList(); - } -} -- cgit v1.2.3-70-g09d2