Пример #1
0
        private void DrawProjectiles(LevelProgression levelProgression)
        {
            foreach (Projectile projectile in level.Projectiles)
            {
                float halfProjectileWidth = VisualValues.HalfProjectileWidthHeight * 0.95f;

                Vector2 projectilePosition = levelProgression.GetProjectilePosition(projectile);

                float leftX  = projectilePosition.X - halfProjectileWidth;
                float rightX = projectilePosition.X + halfProjectileWidth;

                DrawProjectile(projectilePosition);
            }
        }
Пример #2
0
        public List <Projectile> GetPlayerProjectileCollisions(LevelProgression levelProgression)
        {
            List <Projectile> projectilesCollidedWith = new List <Projectile>();

            Hitbox playerHitbox = GetPlayerHitbox(levelProgression.CurrentPlayerPosition, levelProgression.IsPlayerStanding);

            foreach (Projectile projectile in level.Projectiles)
            {
                if (levelProgression.IsProjectileDeflected(projectile))
                {
                    continue;
                }

                Hitbox projectileHitbox = Hitboxes.GetProjectileHitbox(levelProgression.GetProjectilePosition(projectile));

                if (playerHitbox.CollidesWith(projectileHitbox))
                {
                    projectilesCollidedWith.Add(projectile);
                }
            }

            return(projectilesCollidedWith);
        }