Exemplo n.º 1
0
        private void ProcessEntityPair(Entity entityA, Entity entityB)
        {
            if (ActionOnContacts.HasComponent(entityA))
            {
                DynamicBuffer <ActionOnColliderContact> actions = ActionOnContacts[entityA];
                ActorFilterInfo entityAInfo = Helpers.GetActorFilterInfo(entityA, Teams, FirstInstigators, TileColliderTags);
                ActorFilterInfo entityBInfo = Helpers.GetActorFilterInfo(entityB, Teams, FirstInstigators, TileColliderTags);

                for (int i = 0; i < actions.Length; i++)
                {
                    ActionOnColliderContact actionOnContact = actions[i];

                    if (MutedActions.IsMuted(entityA, entityB, actionOnContact.Data.Id))
                    {
                        continue;
                    }

                    if (Helpers.ActorFilterMatches(entityAInfo, entityBInfo, actionOnContact.Data.ActionFilter))
                    {
                        OutActions.Add(new GameActionRequest()
                        {
                            Instigator   = entityA,
                            Target       = entityB,
                            ActionEntity = actionOnContact.Data.ActionEntity,
                        });

                        if (actionOnContact.Data.SameTargetCooldown > 0)
                        {
                            MutedActions.Add(new MutedContactActionElement()
                            {
                                Instigator            = entityA,
                                ContactActionBufferId = actionOnContact.Data.Id,
                                ExpirationTime        = actionOnContact.Data.SameTargetCooldown,
                                Target = entityB
                            });
                        }
                    }
                }
            }
        }