コード例 #1
0
        /// <summary>Removes the specified <seealso cref="ObjectHitboxDefinition"/> from the dictionary.</summary>
        /// <param name="definition">The <seealso cref="ObjectHitboxDefinition"/> to remove from the dictionary.</param>
        public bool Remove(ObjectHitboxDefinition definition)
        {
            bool result = list.Remove(definition);

            if (result)
            {
                RemoveFromAllIDs(definition.ObjectIDs);
            }
            return(result);
        }
コード例 #2
0
        /// <summary>Adds a new <seealso cref="ObjectHitboxDefinition"/> to the dictionary.</summary>
        /// <param name="definition">The <seealso cref="ObjectHitboxDefinition"/> to add to the dictionary.</param>
        public void Add(ObjectHitboxDefinition definition)
        {
            var f = Find(definition.Hitbox);

            if (f == null)
            {
                list.Add(definition);
            }
            else
            {
                f.ObjectIDs.AddRange(definition.ObjectIDs);
            }
            allIDs?.AddRange(definition.ObjectIDs);
            Validate();
        }
コード例 #3
0
 /// <summary>Determines whether this <seealso cref="ObjectHitboxDefinition"/> equals another <seealso cref="ObjectHitboxDefinition"/>.</summary>
 /// <param name="obj">The other <seealso cref="ObjectHitboxDefinition"/> to compare this with.</param>
 public bool Equals(ObjectHitboxDefinition other) => other.ObjectIDs.ContainsAll(ObjectIDs) && other.Hitbox == Hitbox;
コード例 #4
0
 /// <summary>Determines whether the dictionary contains a definition with the specified object IDs and the respective hitbox.</summary>
 /// <param name="definition">The <seealso cref="ObjectHitboxDefinition"/> to check if it is contained.</param>
 public bool Contains(ObjectHitboxDefinition definition) => list.Contains(definition);