Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
CollisionProfile.cs
1using Newtonsoft.Json;
2
4
9public sealed class CollisionProfile
10{
18 [JsonConstructor]
20 string name,
21 string collisionGroup,
22 IEnumerable<string>? collidesWith = null,
23 bool collidesWithAll = false)
24 {
25 if (string.IsNullOrWhiteSpace(name))
26 throw new ArgumentException("Collision profile name cannot be empty.", nameof(name));
27
28 if (string.IsNullOrWhiteSpace(collisionGroup))
29 throw new ArgumentException("Collision profile group cannot be empty.", nameof(collisionGroup));
30
31 Name = name;
32 CollisionGroup = collisionGroup;
33 CollidesWith = collidesWith?.ToList() ?? [];
34 CollidesWithAll = collidesWithAll;
35 }
36
40 public string Name { get; private set; }
41
45 public string CollisionGroup { get; set; }
46
50 public List<string> CollidesWith { get; private set; }
51
55 public bool CollidesWithAll { get; set; }
56
63 {
64 ArgumentNullException.ThrowIfNull(groups);
65 return groups.Get(CollisionGroup);
66 }
67
74 {
75 ArgumentNullException.ThrowIfNull(groups);
76 return CollidesWithAll
77 ? CollisionMasks.All
78 : groups.GetMask(CollidesWith);
79 }
80}
Manages collision group definitions and provides bitwise mask values for collision filtering....
int GetMask(IEnumerable< string > names)
Combines previously defined collision groups into one bit mask. An empty collection resolves to Colli...
int Get(string name)
Gets the bit flag value for a previously defined collision group.
string Name
Gets the stable profile name.
string CollisionGroup
Gets or sets the registered collision group name assigned to this profile.
int ResolveCollisionGroup(CollisionGroupRegistry groups)
Resolves this profile's own group through the supplied scene registry.
int ResolveCollidesWith(CollisionGroupRegistry groups)
Resolves this profile's interaction mask through the supplied scene registry.
List< string > CollidesWith
Gets the registered group names with which this profile interacts.
CollisionProfile(string name, string collisionGroup, IEnumerable< string >? collidesWith=null, bool collidesWithAll=false)
Initializes a collision profile.
bool CollidesWithAll
Gets or sets whether this profile interacts with every collision group.