コード例 #1
0
        /// <summary>
        /// Fills the results array with interaction results based on the given interaction data.
        /// </summary>
        /// <param name="interactionData">The interaction data to create results for.</param>
        /// <param name="results">An array to fill with interaction results.</param>
        /// <returns>The number of results.</returns>
        public override int GetInteractionResultsNonAlloc <T>(T interactionData, IInteractionResult[] results)
        {
            int count = 0;

            ImpactTagMask tagMask = interactionData.TagMask ?? FallbackTagMask;

            for (int i = 0; i < InteractionSetCount || count >= results.Length; i++)
            {
                ImpactMaterialInteractionSet interactionSet = _interactionSets[i];
                populateCollisionResultsForInteractionSet(interactionData, interactionSet, tagMask, results, ref count);
            }

            return(count);
        }
コード例 #2
0
 public void AddInteractionSet(ImpactMaterialInteractionSet item)
 {
     _interactionSets.Add(item);
 }
コード例 #3
0
        private void populateCollisionResultsForInteractionSet <T>(T interactionData, ImpactMaterialInteractionSet interactionSet, ImpactTagMask tagMask, IInteractionResult[] results, ref int count) where T : IInteractionData
        {
            if (interactionSet.CompareTagMaskFilters(tagMask))
            {
                for (int j = 0; j < interactionSet.InteractionCount || count >= results.Length; j++)
                {
                    IInteractionResult c = interactionSet[j].GetInteractionResult(interactionData);
                    if (c == null)
                    {
                        continue;
                    }

                    if (c.IsValid)
                    {
                        results[count] = c;
                        count++;
                    }
                    else
                    {
                        c.Dispose();
                    }
                }
            }
        }