Ejemplo n.º 1
0
        /// <summary>
        /// Disposes a Projectile from the EnemyProjectile List if its Destruct bool is true
        /// </summary>
        /// <param name="lProjectile">EnemyProjectile List where Projectiles will be Disposed if necessary</param>
        /// <param name="Damage">Damage inflicted to the Player when hit</param>
        protected void DisposeProjectile(List <EnemyProjectile> lProjectile, uint Damage)
        {
            for (int x = 0; x < lProjectile.Count; x++)
            {
                if (lProjectile[x].Destruct() || PlayerProjectileCollision(lProjectile[x], Damage))
                {
                    lProjectile[x].DisposeTexture();
                    for (int y = x; y + 1 < lProjectile.Count; y++)
                    {
                        lProjectile[y] = lProjectile[y + 1];
                    }

                    if (lProjectile.Count == 1)
                    {
                        lProjectile.RemoveAt(0);
                    }
                    else
                    {
                        lProjectile.RemoveAt(lProjectile.Count - 1);
                    }

                    SoundManager.PlaySpecificSound(Sounds.Impact);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shoots a PlayerProjectile
        /// </summary>
        /// <param name="TileMapPosition">Position of the TileMap</param>
        protected void Shoot(Vector2f TileMapPosition)
        {
            pProjectile = new PlayerProjectile(fAngle, (Vector2f)vMousePositionFromPlayer, 1);

            lProjectile.Add(pProjectile);

            SoundManager.PlaySpecificSound(Sounds.Shot);
        }
Ejemplo n.º 3
0
        // DECLARING METHODS: PROJECTILES

        /// <summary>
        /// Shoots a Projectile to the Player's Position
        /// </summary>
        protected void Shoot()
        {
            Vector2f vEnemyShootingDirection = sEntity.Position + new Vector2f(0, 25);

            vEnemyShootingDirection = Utilities.VectorRotation(fAnglecopy / fNumberToCorrect, vEnemyShootingDirection, sEntity.Position);

            pProjectile = new EnemyProjectile(fAngle, sEntity.Position, vEnemyShootingDirection, 1);

            lProjectile.Add(pProjectile);

            SoundManager.PlaySpecificSound(Sounds.Shot);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates the Main Map Logic
        /// </summary>
        public override eMapState Update(RenderWindow window)
        {
            left  = false;
            right = false;
            up    = false;
            down  = false;

            vPastTileMapPosition       = vPresentTileMapPosition;
            vPresentTileMapPosition    = vTileMapPosition;
            vDifferenceTileMapPosition = vPastTileMapPosition - vPresentTileMapPosition;

            cCamera.Update(vPlayerVirtualPosition, ref vTileMapPosition);

            for (int x = 0; x < lEnemies.Count; x++)
            {
                Vector2f EnemyPosition = lEnemies[x].GetPosition();

                if (EnemyPosition.X > GameLoop.GetWindowSize().X || EnemyPosition.X < -50 ||
                    EnemyPosition.Y > GameLoop.GetWindowSize().Y || EnemyPosition.Y < -50)
                {
                    lEnemies[x].PassiveUpdate();
                    continue;
                }

                lEnemies[x].Update(ref vPlayerVirtualPosition, ref up, ref down, ref right, ref left);

                if (lEnemies[x].GetHealth() <= 0)
                {
                    if (lEnemies[x].GetIsBoss())
                    {
                        uiKillCount++;
                        Player.LevelUp();
                    }
                    SoundManager.PlaySpecificSound(Sounds.Death);

                    lEnemies.RemoveAt(x);
                }
            }

            pPlayer.Update(ref vPlayerVirtualPosition, ref up, ref down, ref right, ref left);

            textQuest = new Text(questTracker.Update(uiKillCount), fFont, 20);

            iInput.Update(ref vPlayerVirtualPosition, ref Player.fSpeed, up, right, down, left, window);

            return(eTargetMap);
        }