Пример #1
0
        /// <summary>
        /// Gets an arbiter by it's bodies. Not threadsafe.
        /// </summary>
        /// <param name="body1">The first body.</param>
        /// <param name="body2">The second body.</param>
        /// <param name="arbiter">The arbiter which was found.</param>
        /// <returns>Returns true if the arbiter could be found, otherwise false.</returns>
        public bool LookUpArbiter(RigidBody body1, RigidBody body2, out Arbiter arbiter)
        {
            lookUpKey.SetBodies(body1, body2);
            if (!dictionaryKeys.ContainsKey(lookUpKey))
            {
                arbiter = null;
                return(false);
            }

            arbiter = dictionaryKeys[lookUpKey];
            return(true);
        }
Пример #2
0
 /// <summary>
 /// Gets an arbiter by it's bodies. Not threadsafe.
 /// </summary>
 /// <param name="body1">The first body.</param>
 /// <param name="body2">The second body.</param>
 /// <param name="arbiter">The arbiter which was found.</param>
 /// <returns>Returns true if the arbiter could be found, otherwise false.</returns>
 public bool LookUpArbiter(RigidBody body1, RigidBody body2, out Arbiter arbiter)
 {
     lookUpKey.SetBodies(body1, body2);
     return(dictionaryKeys.TryGetValue(lookUpKey.GetHashCode(), out arbiter));
 }