Files
sbox-public/engine/Sandbox.Engine/Scene/Components/Game/Hitbox.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

34 lines
757 B
C#

namespace Sandbox;
[Expose]
public class Hitbox : IDisposable
{
internal Hitbox( GameObject gameObject, ITagSet tagSet, PhysicsBody body )
{
GameObject = gameObject;
Body = body;
Tags = tagSet;
Body.MotionEnabled = false;
Body.BodyType = PhysicsBodyType.Keyframed;
Body.Hitbox = this;
}
internal Hitbox( GameObject gameObject, BoneCollection.Bone bone, ITagSet tagSet, PhysicsBody body ) : this( gameObject, tagSet, body )
{
Bone = bone;
}
public GameObject GameObject { get; private set; }
public BoneCollection.Bone Bone { get; private set; }
public ITagSet Tags { get; private set; }
public PhysicsBody Body { get; set; }
internal BBox Bounds { get; set; }
public void Dispose()
{
Body?.Remove();
Body = null;
}
}