Beispiel #1
0
        public override void Update(double deltaTime)
        {
            MoveProjectile(deltaTime);

            m_fuseTimer -= deltaTime;

            bool detonate = false;

            if (_owner.GetComponent <CircleCollider>() != null)
            {
                CircleCollider collider = _owner.GetComponent <CircleCollider>();
                ContactEdge    c        = collider.GetBody().ContactList;

                while (c != null && c.Next != null)
                {
                    if (c.Contact.IsTouching)
                    {
                        Entity e = (Entity)c.Other.UserData;
                        if (e != Owner)
                        {
                            if (e.Tags.Contains("Actor") && m_actorImpactTrigger)
                            {
                                detonate = true;
                            }
                            if (!e.Tags.Contains("Actor") && m_objectImpactTrigger)
                            {
                                detonate = true;
                            }

                            ImpactAttack(e);
                        }
                    }
                    c = c.Next;
                }
            }

            if (_owner.GetComponent <OOBBTrigger>() != null)
            {
                OOBBTrigger trigger = _owner.GetComponent <OOBBTrigger>();
                ContactEdge c       = trigger.Body.ContactList;

                while (c != null && c.Next != null)
                {
                    if (c.Contact.IsTouching)
                    {
                        Entity e = (Entity)c.Other.UserData;
                        if (e != Owner)
                        {
                            if (e.Tags.Contains("Actor") && m_actorImpactTrigger)
                            {
                                detonate = true;
                            }
                            if (!e.Tags.Contains("Actor") && m_objectImpactTrigger)
                            {
                                detonate = true;
                            }

                            ImpactAttack(e);
                        }
                    }
                    c = c.Next;
                }
            }

            if (m_fuseTimer < 0)
            {
                detonate = true;
            }

            if (detonate)
            {
                Detonate();
            }
        }