aboutsummaryrefslogtreecommitdiffstats
path: root/code/entity/Footprint.cs
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2023-08-06 17:21:45 +0100
committerLeonardo Bishop <me@leonardobishop.com>2023-08-06 17:21:45 +0100
commit0bba89a7858ce091f485e04284f853e1f7f304af (patch)
tree89ba42616e0f245cc84c96cc5b353eea117057d0 /code/entity/Footprint.cs
parent87d74b50bf443bf199be05bd03afdca6ece082ff (diff)
ReformatHEADmaster
Diffstat (limited to 'code/entity/Footprint.cs')
-rw-r--r--code/entity/Footprint.cs36
1 files changed, 19 insertions, 17 deletions
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 );
}