Пример #1
0
        private void SetNewProjectilePositions()
        {
            LevelProgression levelProgression = GetLevelProgression();

            foreach (Projectile projectile in levelAttempt.Level.Projectiles)
            {
                Vector2 movementDelta;

                if (levelProgression.IsProjectileDeflected(projectile))
                {
                    movementDelta = levelProgression.GetProjectileDeflectionDirection(projectile) / GeneralValues.FPS;
                }
                else
                {
                    movementDelta = new Vector2(-PhysicsValues.GetProjectileVelocityPerFrame(), 0);
                }

                levelProgression.MoveProjectile(projectile, movementDelta);
            }
        }
Пример #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);
        }