Example #1
0
        void RunProjectileAttacks()
        {
            foreach (Entity entity in Engine.Entities)
            {
                Projectile projectile = entity as Projectile;
                if (projectile == null)
                {
                    continue;
                }

                if (projectile.CanAttack() == false)
                {
                    continue;
                }

                foreach (Entity subentity in Engine.Entities)
                {
                    if (projectile == subentity)
                    {
                        continue;
                    }

                    if (projectile.CanAttack() == false)
                    {
                        break;
                    }

                    Character character = subentity as Character;
                    if (character != null)
                    {
                        ProjectileAttack(projectile, character);
                    }

                    Projectile otherprojectile = subentity as Projectile;
                    if (otherprojectile != null)
                    {
                        if (projectile.Team == otherprojectile.Team)
                        {
                            continue;
                        }
                        if (Collision.HasCollision(projectile, ClsnType.Type1Attack, otherprojectile, ClsnType.Type1Attack) == false)
                        {
                            continue;
                        }

                        ProjectileContact(projectile, otherprojectile);
                    }
                }
            }
        }