/// <summary> /// Detects Collision between Player and Invisible Projectile, returns true if Collision occures /// </summary> /// <param name="iProjectile">Projectile that Collision is checked with</param> protected bool PlayerProjectileCollision(InvisibleProjectile iProjectile) { Vector2f vPlayerPosition = MainMap.GetStartCharacterPosition(); Vector2f b = MainMap.GetStartCharacterPosition() + new Vector2f(25, 25) - sEntity.Position; if (vPlayerPosition.Y < iProjectile.vEntityPosition.Y && vPlayerPosition.Y + 50 > iProjectile.vEntityPosition.Y && vPlayerPosition.X < iProjectile.vEntityPosition.X && vPlayerPosition.X + 50 > iProjectile.vEntityPosition.X) { return(true); } return(false); }
/// <summary> /// Shoots fast invisible Projectiles to check Visibility /// </summary> /// <param name="TileMapPosition">Position of the TileMap</param> /// <param name="fAngle">Angle where to shoot the Invisible Projectile to</param> protected void ShootInvisible(Vector2f TileMapPosition, float fAngle) { Vector2f vEnemyShootingLeft = sEntity.Position + new Vector2f(-20, 0); vEnemyShootingLeft = Utilities.VectorRotation(fAnglecopy / fNumberToCorrect, vEnemyShootingLeft, sEntity.Position); Vector2f vEnemyShootingMiddle = sEntity.Position + new Vector2f(0, 25); vEnemyShootingMiddle = Utilities.VectorRotation(fAnglecopy / fNumberToCorrect, vEnemyShootingMiddle, sEntity.Position); Vector2f vEnemyShootingRight = sEntity.Position + new Vector2f(20, 0); vEnemyShootingRight = Utilities.VectorRotation(fAnglecopy / fNumberToCorrect, vEnemyShootingRight, sEntity.Position); iProjectile = new InvisibleProjectile(vEnemyShootingLeft, vEnemyShootingMiddle + (vEnemyShootingLeft - sEntity.Position), 3.5f); lInvisibleProjectileRight.Add(iProjectile); //iProjectile = new InvisibleProjectile(fAnglecopy, sEntity.Position, vEnemyShootingMiddle, 3.5f); //lInvisibleProjectileMiddle.Add(iProjectile); iProjectile = new InvisibleProjectile(vEnemyShootingRight, vEnemyShootingMiddle + (vEnemyShootingRight - sEntity.Position), 3.5f); lInvisibleProjectileLeft.Add(iProjectile); }