Exemplo n.º 1
0
        //=====================================================================
        #region Protected methods
        //=====================================================================
        /// <summary>
        /// Processes the collision between colliders. Ignores certain collisions.
        /// Deals health effects to anything that has an IHealth component.
        /// Reflects off of anything that doesn't. Applies knockback effects.
        /// Lights enemies on fire.
        /// Destorys the object if it is on its last collision.
        /// </summary>
        /// <param name="collider">
        /// The collider that is interacting with the projectile trigger.
        /// </param>
        protected override void ProcessColliderInteraction(Collider collider)
        {
            if (base.IgnoreCollision(collider))
            {
                return;
            }
            prevGameObject = collider.gameObject;
            IHealth     health = collider.gameObject.GetComponent <IHealth>();
            EntityStats es     = collider.gameObject.GetComponent <EntityStats>();

            if (es != null)
            {
                es.IsCombusting = true;
            }
            if (health == null)
            {
                Reflect();
            }
            else
            {
                base.ProcessHealthEffects(collider, health);
            }
            Knockback(collider);
            if (IsDestroyed())
            {
                Destroy(this.gameObject);
            }
        }
Exemplo n.º 2
0
        private void OnCollisionEnter(Collision other)
        {
            EntityStats es = other.gameObject.GetComponent <EntityStats>();

            if (es != null)
            {
                es.IsCombusting = true;
            }
        }