mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-03 03:48:24 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
46 lines
850 B
C#
46 lines
850 B
C#
namespace Sandbox;
|
|
|
|
public partial class DebugOverlaySystem
|
|
{
|
|
List<Entry> entries = new();
|
|
|
|
class Entry : IDisposable
|
|
{
|
|
public bool CreatedDuringFixed;
|
|
public bool SingleFrame = true;
|
|
public float life;
|
|
public SceneObject sceneObject;
|
|
|
|
public Entry( float duration, bool fixedUpdate, SceneObject so )
|
|
{
|
|
CreatedDuringFixed = fixedUpdate;
|
|
sceneObject = so;
|
|
|
|
if ( duration > 0 )
|
|
{
|
|
life = duration;
|
|
SingleFrame = false;
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
sceneObject?.Delete();
|
|
sceneObject = default;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Add an entry manually
|
|
/// </summary>
|
|
void Add( float duration, SceneObject so )
|
|
{
|
|
// common flags for debug overlays
|
|
so.Flags.IncludeInCubemap = false;
|
|
so.Tags.Add( "debugoverlay" );
|
|
|
|
var entry = new Entry( duration, inFixedUpdate, so );
|
|
entries.Add( entry );
|
|
}
|
|
}
|