/// <summary>Returns a <seealso cref="ObjectHitboxDefinition"/> that matches a given list of object IDs or <see langword="null"/> if not found.</summary> /// <param name="hitbox">The hitbox that the requested <seealso cref="ObjectHitboxDefinition"/> contains.</param> public ObjectHitboxDefinition Find(Hitbox hitbox) => list.Find(d => d.Hitbox == hitbox);
/// <summary>Sets the <seealso cref="Hitbox"/> of a specified object ID.</summary> /// <param name="objectID">The object ID whose <seealso cref="Hitbox"/> to set.</param> /// <param name="hitbox">The <seealso cref="Hitbox"/> to set.</param> public void SetHitbox(int objectID, Hitbox hitbox) { RemoveDefinition(objectID); Add(objectID, hitbox); }
/// <summary>Sets the <seealso cref="Hitbox"/> of a specified object ID. Returns <see langword="null"/> if the object IDs' <seealso cref="Hitbox"/> is not common. Throws respective exceptions on other errors.</summary> /// <param name="objectIDs">The object ID whose <seealso cref="Hitbox"/> to set.</param> /// <param name="hitbox">The <seealso cref="Hitbox"/> to set.</param> public void SetCommonHitbox(List <int> objectIDs, Hitbox hitbox) { RemoveMultipleDefinitions(objectIDs); Add(objectIDs, hitbox); }
/// <summary>Determines whether the dictionary contains an entry with the specified object IDs mapped to the specified hitbox.</summary> /// <param name="objectIDs">The object IDs to check whether they are mapped to the specified hitbox.</param> /// <param name="hitbox">The hitbox to check whether it's mapped to the specified object IDs.</param> public bool Contains(List <int> objectIDs, Hitbox hitbox) => list.Any(m => m.ObjectIDs.ContainsAll(objectIDs) && m.Hitbox == hitbox);
/// <summary>Adds a new <seealso cref="ObjectHitboxDefinition"/> to the dictionary.</summary> /// <param name="objectIDs">The object IDs to use.</param> /// <param name="hitbox">The <seealso cref="Hitbox"/> that will be added.</param> public void Add(List <int> objectIDs, Hitbox hitbox) => Add(new ObjectHitboxDefinition(objectIDs, hitbox));
/// <summary>Adds a new <seealso cref="ObjectHitboxDefinition"/> to the dictionary.</summary> /// <param name="objectID">The object ID to use.</param> /// <param name="hitbox">The <seealso cref="Hitbox"/> that will be added.</param> public void Add(int objectID, Hitbox hitbox) => Add(new ObjectHitboxDefinition(objectID, hitbox));
/// <summary>Initializes a new instance of the <seealso cref="ObjectHitboxDefinition"/> class.</summary> /// <param name="objectIDs">The object IDs that this hitbox is valid for.</param> /// <param name="hitbox">The hitbox of the object IDs.</param> public ObjectHitboxDefinition(List <int> objectIDs, Hitbox hitbox) { ObjectIDs = objectIDs; Hitbox = hitbox; }
/// <summary>Initializes a new instance of the <seealso cref="ObjectHitboxDefinition"/> class.</summary> /// <param name="objectID">The object ID that this hitbox is valid for.</param> /// <param name="hitbox">The hitbox of the object IDs.</param> public ObjectHitboxDefinition(int objectID, Hitbox hitbox) : this(new List <int> { objectID }, hitbox) { }