From 0bba89a7858ce091f485e04284f853e1f7f304af Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sun, 6 Aug 2023 17:21:45 +0100 Subject: Reformat --- code/entity/Footprint.cs | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'code/entity/Footprint.cs') diff --git a/code/entity/Footprint.cs b/code/entity/Footprint.cs index 8941e95..f4b988d 100644 --- a/code/entity/Footprint.cs +++ b/code/entity/Footprint.cs @@ -1,25 +1,24 @@ using System; +using Sandbox; namespace MurderGame; -using Sandbox; // It's just a square with a material slapped onto it. public class Footprint : RenderEntity { + private readonly TimeSince TimeSinceCreated = 0; public Material SpriteMaterial { get; set; } public float SpriteScale { get; set; } = 18f; public bool Enabled { get; set; } = true; - + public Color Color { get; set; } - private TimeSince TimeSinceCreated = 0; - [GameEvent.Tick.Client] public void OnTick() { - if ( !(TimeSinceCreated > Math.Clamp(MurderGame.MaxFootprintTime, 0, 30)) ) + if ( !(TimeSinceCreated > Math.Clamp( MurderGame.MaxFootprintTime, 0, 30 )) ) { return; } @@ -27,28 +26,31 @@ public class Footprint : RenderEntity Enabled = false; Delete(); } - - public override void DoRender(SceneObject obj) + + public override void DoRender( SceneObject obj ) { - if (!Enabled) return; + if ( !Enabled ) + { + return; + } // Allow lights to affect the sprite - Graphics.SetupLighting(obj); + Graphics.SetupLighting( obj ); // Create the vertex buffer for the sprite var vb = new VertexBuffer(); - vb.Init(true); + vb.Init( true ); // Vertex buffers are in local space, so we need the camera position in local space too var normal = new Vector3( 0, 0.01f, 100 ); - var w = normal.Cross(Vector3.Down).Normal; - var h = normal.Cross(w).Normal; - float halfSpriteSize = SpriteScale / 2; + var w = normal.Cross( Vector3.Down ).Normal; + var h = normal.Cross( w ).Normal; + var halfSpriteSize = SpriteScale / 2; // Add a single quad to our vertex buffer - vb.AddQuad(new Ray(default, normal), halfSpriteSize*w, h*halfSpriteSize); - - Graphics.Attributes.Set( "color", Color); - + vb.AddQuad( new Ray( default, normal ), halfSpriteSize * w, h * halfSpriteSize ); + + Graphics.Attributes.Set( "color", Color ); + // Draw the sprite vb.Draw( SpriteMaterial ); } -- cgit v1.2.3-70-g09d2