private static void triggerOnHitObject <T>(T interactionData, IImpactObject otherObject, int physicsMaterialId, bool useMaterialComposition) where T : IInteractionData
 {
     if (otherObject != null)
     {
         if (useMaterialComposition)
         {
             int count = otherObject.GetMaterialCompositionNonAlloc(interactionData.Point, ImpactManagerInstance.MaterialCompositionBuffer);
             for (int i = 0; i < count; i++)
             {
                 ImpactMaterialComposition comp = ImpactManagerInstance.MaterialCompositionBuffer[i];
                 if (comp.CompositionValue > 0)
                 {
                     IInteractionData newInteractionData = interactionData.Clone();
                     newInteractionData.CompositionValue = comp.CompositionValue;
                     ImpactManagerInstance.ProcessInteraction(newInteractionData, comp.Material, otherObject);
                 }
             }
         }
         else
         {
             ImpactManagerInstance.ProcessInteraction(interactionData, otherObject);
         }
     }
     else if (ImpactManagerInstance.UseMaterialMapping)
     {
         IImpactMaterial m;
         if (ImpactManagerInstance.TryGetImpactMaterialFromMapping(physicsMaterialId, out m))
         {
             ImpactManagerInstance.ProcessInteraction(interactionData, m, null);
         }
     }
 }
Exemple #2
0
 protected override bool HasEventOccurredInInteraction(IInteractionData interaction)
 {
     Assert.ArgumentNotNull(interaction, "interaction");
     Assert.IsNotNull(interaction.Pages, "interaction.Pages is not initialized.");
     return(interaction.Pages.SelectMany((Page page) => page.PageEvents).Any(delegate(PageEventData pageEvent)
     {
         if (pageEvent.IsGoal)
         {
             Guid pageEventDefinitionId = pageEvent.PageEventDefinitionId;
             Guid?b = GoalGuid;
             return pageEventDefinitionId == b;
         }
         return false;
     }));
 }
        private static void triggerOnRaycastingObject <T>(T interactionData, IImpactObject impactObject, IImpactObject otherObject, int physicsMaterialId, bool useMaterialComposition) where T : IInteractionData
        {
            if (otherObject != null)
            {
                if (useMaterialComposition)
                {
                    int count = otherObject.GetMaterialCompositionNonAlloc(interactionData.Point, ImpactManagerInstance.MaterialCompositionBuffer);
                    for (int i = 0; i < count; i++)
                    {
                        ImpactMaterialComposition comp = ImpactManagerInstance.MaterialCompositionBuffer[i];
                        if (comp.CompositionValue > 0)
                        {
                            IInteractionData newInteractionData = interactionData.Clone();
                            newInteractionData.CompositionValue = comp.CompositionValue;
                            newInteractionData.TagMask          = comp.Material.MaterialTagsMask;
                            ImpactManagerInstance.ProcessInteraction(newInteractionData, impactObject);
                        }
                    }
                }
                else
                {
                    IImpactMaterial material = otherObject.GetPrimaryMaterial(interactionData.Point);
                    if (material != null || (ImpactManagerInstance.UseMaterialMapping && ImpactManagerInstance.TryGetImpactMaterialFromMapping(physicsMaterialId, out material)))
                    {
                        interactionData.TagMask = material.MaterialTagsMask;
                    }

                    ImpactManagerInstance.ProcessInteraction(interactionData, impactObject);
                }
            }
            else if (ImpactManagerInstance.UseMaterialMapping)
            {
                IImpactMaterial material;
                if (ImpactManagerInstance.TryGetImpactMaterialFromMapping(physicsMaterialId, out material))
                {
                    interactionData.TagMask = material.MaterialTagsMask;
                }

                ImpactManagerInstance.ProcessInteraction(interactionData, impactObject);
            }
        }
Exemple #4
0
 protected abstract bool HasEventOccurredInInteraction(IInteractionData interaction);