Java 类org.lwjgl.util.vector.Vector2f 实例源码

项目:MRCEngine    文件:OBJFileLoader.java   
private static float convertDataToArrays(List<Vertex> vertices, List<Vector2f> textures,
        List<Vector3f> normals, float[] verticesArray, float[] texturesArray,
        float[] normalsArray) {
    float furthestPoint = 0;
    for (int i = 0; i < vertices.size(); i++) {
        Vertex currentVertex = vertices.get(i);
        if (currentVertex.getLength() > furthestPoint) {
            furthestPoint = currentVertex.getLength();
        }
        Vector3f position = currentVertex.getPosition();
        Vector2f textureCoord = textures.get(currentVertex.getTextureIndex());
        Vector3f normalVector = normals.get(currentVertex.getNormalIndex());
        verticesArray[i * 3] = position.x;
        verticesArray[i * 3 + 1] = position.y;
        verticesArray[i * 3 + 2] = position.z;
        texturesArray[i * 2] = textureCoord.x;
        texturesArray[i * 2 + 1] = 1 - textureCoord.y;
        normalsArray[i * 3] = normalVector.x;
        normalsArray[i * 3 + 1] = normalVector.y;
        normalsArray[i * 3 + 2] = normalVector.z;
    }
    return furthestPoint;
}
项目:Elgin-Plant-Game    文件:OBJFileLoader.java   
private static float convertDataToArrays(List<Vertex> vertices, List<Vector2f> textures,
        List<Vector3f> normals, float[] verticesArray, float[] texturesArray,
        float[] normalsArray) {
    float furthestPoint = 0;
    for (int i = 0; i < vertices.size(); i++) {
        Vertex currentVertex = vertices.get(i);
        if (currentVertex.getLength() > furthestPoint) {
            furthestPoint = currentVertex.getLength();
        }
        Vector3f position = currentVertex.getPosition();
        Vector2f textureCoord = textures.get(currentVertex.getTextureIndex());
        Vector3f normalVector = normals.get(currentVertex.getNormalIndex());
        verticesArray[i * 3] = position.x;
        verticesArray[i * 3 + 1] = position.y;
        verticesArray[i * 3 + 2] = position.z;
        texturesArray[i * 2] = textureCoord.x;
        texturesArray[i * 2 + 1] = 1 - textureCoord.y;
        normalsArray[i * 3] = normalVector.x;
        normalsArray[i * 3 + 1] = normalVector.y;
        normalsArray[i * 3 + 2] = normalVector.z;
    }
    return furthestPoint;
}
项目:shadowyards    文件:MS_TAGOnHitEffect.java   
@Override
public void onHit (DamagingProjectileAPI projectile, CombatEntityAPI target, Vector2f point, boolean shieldHit, CombatEngineAPI engine) {
    ShipAPI source = projectile.getSource();

    if (target instanceof ShipAPI && !shieldHit) {
        ShipAPI ship = (ShipAPI) target;
        String id = ship.getFleetMemberId();

        //((MS_TAGSystemEffect) projectile.getWeapon().getEffectPlugin()).putTELEMETRY(ship);
        if (!ship.isAlive() || ship.isAlly() || ship.getOwner() == source.getOwner()) {
            return;
        }

        if(affected.containsKey(ship)) {
            ((MS_TAGSystemEffect) projectile.getWeapon().getEffectPlugin()).putTELEMETRY(ship, affected.get(ship) + debuffDuration);
        } else {
            ((MS_TAGSystemEffect) projectile.getWeapon().getEffectPlugin()).putTELEMETRY(ship, debuffDuration);
        }
    }
}
项目:shadowyards    文件:MS_PolarizerSmallOnHitEffect.java   
@Override
public void onHit(DamagingProjectileAPI projectile, CombatEntityAPI target, Vector2f point, boolean shieldHit, CombatEngineAPI engine) {
    if (point == null) {
        return;
    }
    if (target instanceof ShipAPI) {
        ShipAPI ship = (ShipAPI) target;

        if ((shieldHit || ship.getVariant().getHullMods().contains("tem_latticeshield") && ((!ShadowyardsModPlugin.templarsExist || TEM_LatticeShield.shieldLevel(ship) > 0f) || !ship.getVariant().getHullMods().contains("tem_latticeshield")))) {
        } else {
            engine.addSmoothParticle(point, new Vector2f(), 300f, 1f, 0.75f, new Color(100, 255, 200, 255));
            float emp = projectile.getEmpAmount() * 0.15f;
            float dam = projectile.getDamageAmount() * 0.2f;
            for (int x = 0; x < 2; x++) {
                engine.spawnEmpArc(projectile.getSource(), point, projectile.getDamageTarget(), projectile.getDamageTarget(), DamageType.ENERGY, dam, emp, 100000f, null, 20f, new Color(100, 255, 200, 255), new Color(200, 255, 255, 255));
            }
            Global.getSoundPlayer().playSound("ms_lemp_shot_impact", 1f, 1f, point, new Vector2f());
        }
    }
}
项目:shadowyards    文件:MS_WavebeamOnHitEffect.java   
@Override
public void onHit(DamagingProjectileAPI projectile, CombatEntityAPI target, Vector2f point, boolean shieldHit, CombatEngineAPI engine) {
    // Check if we hit a ship (not its shield)
    if (target instanceof ShipAPI && !shieldHit && Math.random() <= EXTRA_DAMAGE_CHANCE) {
        // Apply extra damage of a random type
        engine.applyDamage(target, point,
                MathUtils.getRandomNumberInRange(MIN_EXTRA_DAMAGE, MAX_EXTRA_DAMAGE),
                TYPES[(int) (Math.random() * TYPES.length)], 0f, false,
                true, projectile.getSource());

        // Spawn visual effects
        engine.spawnExplosion(point, (Vector2f) new Vector2f(target.getVelocity()).scale(.48f), EXPLOSION_COLOR, 39f, 1f);
        float speed = projectile.getVelocity().length();
        float facing = 400f;
        for (int x = 0; x < NUM_PARTICLES; x++) {
            engine.addHitParticle(point, MathUtils.getPointOnCircumference(
                    null, MathUtils.getRandomNumberInRange(speed * .007f, speed * .17f),
                    MathUtils.getRandomNumberInRange(facing - 180f, facing + 180f)),
                    5f, 1f, 1.6f, PARTICLE_COLOR);
        }

        // Sound follows enemy that was hit
        Global.getSoundPlayer().playSound(SOUND_ID, 1.1f, 0.5f, target.getLocation(), target.getVelocity());
    }
}
项目:shadowyards    文件:MS_PolarizerOnHitEffect.java   
@Override
public void onHit(DamagingProjectileAPI projectile, CombatEntityAPI target, Vector2f point, boolean shieldHit, CombatEngineAPI engine) {
    if (point == null) {
        return;
    }
    if (target instanceof ShipAPI) {
        ShipAPI ship = (ShipAPI) target;

        if ((shieldHit || ship.getVariant().getHullMods().contains("tem_latticeshield") && ((!ShadowyardsModPlugin.templarsExist || TEM_LatticeShield.shieldLevel(ship) > 0f) || !ship.getVariant().getHullMods().contains("tem_latticeshield")))) {            
        } else {
            engine.addSmoothParticle(point, new Vector2f(), 300f, 1f, 0.75f, new Color(100, 255, 200, 255));
            float emp = projectile.getEmpAmount() * 0.15f;
            float dam = projectile.getDamageAmount() * 0.2f;
            for (int x = 0; x < 6; x++) {
                engine.spawnEmpArc(projectile.getSource(), point, projectile.getDamageTarget(), projectile.getDamageTarget(), DamageType.ENERGY, dam, emp, 100000f, null, 20f, new Color(100, 255, 200, 255), new Color(200, 255, 255, 255));
            }
            Global.getSoundPlayer().playSound("ms_hemp_shot_impact", 1f, 1f, point, new Vector2f());
        }
    }
}
项目:OcclusionQueries    文件:FlareRenderer.java   
private void doOcclusionTest(Vector2f sunScreenCoords) {
    if(query.isResultReady()){
        int visibleSamples = query.getResult();
        this.coverage = Math.min(visibleSamples / TOTAL_SAMPLES, 1f);
    }
    if (!query.isInUse()) {
        GL11.glColorMask(false, false, false, false);
        GL11.glDepthMask(false);
        query.start();
        OpenGlUtils.enableDepthTesting(true);
        shader.transform.loadVec4(sunScreenCoords.x, sunScreenCoords.y, TEST_QUAD_WIDTH, TEST_QUAD_HEIGHT);
        GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4);
        query.end();
        GL11.glColorMask(true, true, true, true);
        GL11.glDepthMask(true);
    }
}
项目:shadowyards    文件:MS_shamashBombPrimer.java   
private void advanceAndRender(float amount)
{
    // Blinker oscillates between -1 and 1, only drawn above 0
    if (amount > 0f)
    {
        blinkProgress += amount * BLINKS_PER_SECOND * (blinkDirection ? 4f : -4f);
        if ((blinkDirection && blinkProgress > 1f)
                || (!blinkDirection && blinkProgress < -1f))
        {
            blinkProgress = (blinkDirection ? 1f : -1f);
            blinkDirection = !blinkDirection;
        }
    }

    if (blinkProgress >= 0f)
    {
        // Render blinker, altering size and intensity based on current blink progress
        sprite.setAlphaMult(Math.min(1f, 0.5f + (blinkProgress / 2f)));
        sprite.setSize(spriteWidth * blinkProgress, spriteHeight * blinkProgress);
        Vector2f loc = MathUtils.getPointOnCircumference(
                bomb.getLocation(), BLINKER_Y_OFFSET, bomb.getFacing());
        sprite.renderAtCenter(loc.x, loc.y);
    }
}
项目:shadowyards    文件:MS_woopDriveAI.java   
@Override
public boolean accept(DamagingProjectileAPI proj) {
    // Exclude missiles and our own side's shots
    if (proj.getOwner() == ship.getOwner() && (!(proj instanceof MissileAPI ) || !((MissileAPI) proj).isFizzling()))
    {
        return false;
    }

    if (proj instanceof MissileAPI) {
        MissileAPI missile = (MissileAPI) proj;
        if (missile.isFlare()) {
            return false;
        }
    }
    // Only include shots that are on a collision path with us
    // Also ensure they aren't travelling AWAY from us ;)
    return (CollisionUtils.getCollides(proj.getLocation(), Vector2f.add(proj.getLocation(), (Vector2f) new Vector2f(proj.getVelocity()).scale(
                SECONDS_TO_LOOK_AHEAD), null), ship.getLocation(), ship.getCollisionRadius())
            && Math.abs(MathUtils.getShortestRotation(proj.getFacing(), VectorUtils.getAngle(proj.getLocation(), ship.getLocation()))) <= 90f);
}
项目:shadowyards    文件:MS_woopDriveAI.java   
@Override
public boolean accept(DamagingProjectileAPI proj) {
    // Exclude missiles and our own side's shots
    if (proj.getOwner() == ship.getOwner() && (!(proj instanceof MissileAPI ) || !((MissileAPI) proj).isFizzling()))
    {
        return false;
    }

    if (proj instanceof MissileAPI) {
        MissileAPI missile = (MissileAPI) proj;
        if (missile.isFlare()) {
            return false;
        }
    }
    // Only include shots that are on a collision path with us
    // Also ensure they aren't travelling AWAY from us ;)
    return (CollisionUtils.getCollides(proj.getLocation(), Vector2f.add(proj.getLocation(), (Vector2f) new Vector2f(proj.getVelocity()).scale(
                SECONDS_TO_LOOK_AHEAD), null), ship.getLocation(), ship.getCollisionRadius())
            && Math.abs(MathUtils.getShortestRotation(proj.getFacing(), VectorUtils.getAngle(proj.getLocation(), ship.getLocation()))) <= 90f);
}
项目:shadowyards    文件:MS_mimirSlideDriveAI.java   
@Override
public boolean accept(DamagingProjectileAPI proj) {
    // Exclude missiles and our own side's shots
    if (proj.getOwner() == ship.getOwner() && (!(proj instanceof MissileAPI ) || !((MissileAPI) proj).isFizzling()))
    {
        return false;
    }

    if (proj instanceof MissileAPI) {
        MissileAPI missile = (MissileAPI) proj;
        if (missile.isFlare()) {
            return false;
        }
    }
    // Only include shots that are on a collision path with us
    // Also ensure they aren't travelling AWAY from us ;)
    return (CollisionUtils.getCollides(proj.getLocation(), Vector2f.add(proj.getLocation(), (Vector2f) new Vector2f(proj.getVelocity()).scale(
                SECONDS_TO_LOOK_AHEAD), null), ship.getLocation(), ship.getCollisionRadius())
            && Math.abs(MathUtils.getShortestRotation(proj.getFacing(), VectorUtils.getAngle(proj.getLocation(), ship.getLocation()))) <= 90f);
}
项目:shadowyards    文件:MS_drivechargerai.java   
@Override
public boolean accept(DamagingProjectileAPI proj) {// Exclude missiles and our own side's shots
    if (proj.getOwner() == ship.getOwner() && (!(proj instanceof MissileAPI ) || !((MissileAPI) proj).isFizzling()))
    {
        return false;
    }

    if (proj instanceof MissileAPI) {
        MissileAPI missile = (MissileAPI) proj;
        if (missile.isFlare()) {
            return false;
        }
    }
    // Only include shots that are on a collision path with us
    // Also ensure they aren't travelling AWAY from us ;)
    return (CollisionUtils.getCollides(proj.getLocation(), Vector2f.add(proj.getLocation(), (Vector2f) new Vector2f(proj.getVelocity()).scale(
                SECONDS_TO_LOOK_AHEAD), null), ship.getLocation(), ship.getCollisionRadius())
            && Math.abs(MathUtils.getShortestRotation(proj.getFacing(), VectorUtils.getAngle(proj.getLocation(), ship.getLocation()))) <= 90f);
}
项目:SerenityCE    文件:TTFFontRenderer.java   
/**
 * Draws a line from start to end with the given width.
 *
 * @param start The starting point of the line.
 * @param end   The ending point of the line.
 * @param width The thickness of the line.
 */
private void drawLine(Vector2f start, Vector2f end, float width) {
    // Disables textures so we can draw a solid line.
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    // Sets the width.
    GL11.glLineWidth(width);

    // Begins drawing the line.
    GL11.glBegin(GL11.GL_LINES); {
        GL11.glVertex2f(start.x, start.y);
        GL11.glVertex2f(end.x, end.y);
    }
    // Ends drawing the line.
    GL11.glEnd();

    // Enables texturing back on.
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
项目:open-world    文件:SkyboxConfiguration.java   
/**
    * Sets the position of the face on the skybox texture (y-up, y=0 at bottom, x=0 at left).
    * @param face The face to update the position of.
    * @param x The x grid position of the face.
    * @param y The y grid position of the face.
    */
   public void set(final SkyboxFace face, final int x, final int y) {
if(x < 0 || y < 0) {
    return;
}

faceTexturePositions.replace(face, new Vector2f(x, y));
   }
项目:OpenGL-Animation    文件:GeometryLoader.java   
private float convertDataToArrays() {
    float furthestPoint = 0;
    for (int i = 0; i < vertices.size(); i++) {
        Vertex currentVertex = vertices.get(i);
        if (currentVertex.getLength() > furthestPoint) {
            furthestPoint = currentVertex.getLength();
        }
        Vector3f position = currentVertex.getPosition();
        Vector2f textureCoord = textures.get(currentVertex.getTextureIndex());
        Vector3f normalVector = normals.get(currentVertex.getNormalIndex());
        verticesArray[i * 3] = position.x;
        verticesArray[i * 3 + 1] = position.y;
        verticesArray[i * 3 + 2] = position.z;
        texturesArray[i * 2] = textureCoord.x;
        texturesArray[i * 2 + 1] = 1 - textureCoord.y;
        normalsArray[i * 3] = normalVector.x;
        normalsArray[i * 3 + 1] = normalVector.y;
        normalsArray[i * 3 + 2] = normalVector.z;
        VertexSkinData weights = currentVertex.getWeightsData();
        jointIdsArray[i * 3] = weights.jointIds.get(0);
        jointIdsArray[i * 3 + 1] = weights.jointIds.get(1);
        jointIdsArray[i * 3 + 2] = weights.jointIds.get(2);
        weightsArray[i * 3] = weights.weights.get(0);
        weightsArray[i * 3 + 1] = weights.weights.get(1);
        weightsArray[i * 3 + 2] = weights.weights.get(2);

    }
    return furthestPoint;
}
项目:VoidApi    文件:WavefrontObject.java   
public void bakeGeometry(List<Vector3f> faces, List<Vector3f> vertexData, List<Vector2f> uvData, List<Vector3f> normalData)
{
    for (Vector3f faceData : faces)
    {
        int vertexIndex = (int) (faceData.getX() - 1);
        int uvIndex = (int) (faceData.getY() - 1);
        int normalIndex = (int) (faceData.getZ() - 1);
        this.vertices.add(new Vertex(vertexData.get(vertexIndex), uvData.get(uvIndex), normalData.get(normalIndex)));
    }
}
项目:Elgin-Plant-Game    文件:Maths.java   
public static float barryCentric(Vector3f p1, Vector3f p2, Vector3f p3, Vector2f pos) {
    float det = (p2.z - p3.z) * (p1.x - p3.x) + (p3.x - p2.x) * (p1.z - p3.z);
    float l1 = ((p2.z - p3.z) * (pos.x - p3.x) + (p3.x - p2.x) * (pos.y - p3.z)) / det;
    float l2 = ((p3.z - p1.z) * (pos.x - p3.x) + (p1.x - p3.x) * (pos.y - p3.z)) / det;
    float l3 = 1.0f - l1 - l2;
    return l1 * p1.y + l2 * p2.y + l3 * p3.y;
}
项目:OcclusionQueries    文件:FlareManager.java   
private Vector2f convertToScreenSpace(Vector3f worldPos, Matrix4f viewMat, Matrix4f projectionMat) {
    Vector4f coords = new Vector4f(worldPos.x, worldPos.y, worldPos.z, 1f);
    Matrix4f.transform(viewMat, coords, coords);
    Matrix4f.transform(projectionMat, coords, coords);
    if (coords.w <= 0) {
        return null;
    }
    //no need for conversion below
    return new Vector2f(coords.x / coords.w, coords.y / coords.w);
}
项目:OcclusionQueries    文件:FlareManager.java   
private void calcFlarePositions(Vector2f sunToCenter, Vector2f sunCoords){
    for(int i=0;i<flareTextures.length;i++){
        Vector2f direction = new Vector2f(sunToCenter);
        direction.scale(i * spacing);
        Vector2f flarePos = Vector2f.add(sunCoords, direction, null);
        flareTextures[i].setScreenPos(flarePos);
    }
}
项目:shadowyards    文件:EndlessRespawn.java   
private Vector2f getSafeSpawn(int side) {
    Vector2f spawnLocation = new Vector2f();

    spawnLocation.x = MathUtils.getRandomNumberInRange(-mapX / 2, mapX / 2);
    if (side == 100 || side == 0) {
        spawnLocation.y = (-mapY / 2f);

    } else {
        spawnLocation.y = mapY / 2;
    }

    return spawnLocation;
}
项目:shadowyards    文件:MS_Barrago_S2_AI.java   
private static void mirv(MissileAPI missile)
{
    Global.getSoundPlayer().playSound(SOUND_ID, 1f, 1f, missile.getLocation(), ZERO);
    Global.getCombatEngine().applyDamage(missile, missile.getLocation(), missile.getHitpoints() * 100f, DamageType.FRAGMENTATION, 0f, false, false, missile);
    Vector2f location = MathUtils.getPointOnCircumference(missile.getLocation(), 5f, missile.getFacing());
    Global.getCombatEngine().spawnProjectile(missile.getSource(), missile.getWeapon(), MIRV_ID, location, missile.getFacing(), missile.getVelocity());
}
项目:shadowyards    文件:Utils.java   
public static Vector2f translate_polar(Vector2f center, float radius, float angle) {
    float radians = (float) Math.toRadians(angle);
    return new Vector2f(
            (float) FastTrig.cos(radians) * radius + (center == null ? 0f : center.x),
            (float) FastTrig.sin(radians) * radius + (center == null ? 0f : center.y)
    );
}
项目:shadowyards    文件:MS_Utils.java   
public static float getActualDistance(Vector2f from, CombatEntityAPI target, boolean considerShield)
{
    if (considerShield && (target instanceof ShipAPI))
    {
        ShipAPI ship = (ShipAPI) target;
        ShieldAPI shield = ship.getShield();
        if (shield != null && shield.isOn() && shield.isWithinArc(from))
        {
            return MathUtils.getDistance(from, shield.getLocation()) - shield.getRadius();
        }
    }
    return MathUtils.getDistance(from, target.getLocation()) - Misc.getTargetingRadius(from, target, false);
}
项目:shadowyards    文件:MS_Utils.java   
public static List<ShipAPI> getSortedAreaList(Vector2f loc, List<ShipAPI> list)
{
    List<ShipAPI> out;
    if (ShadowyardsModPlugin.hasTwigLib)
    {
        List<ShipAPI> temp = new ArrayList<>(list);
        Collections.sort(temp, new SortShipsByDistance(loc));

        out = new ArrayList<>(list.size());
        while (temp.size() > 0)
        {
            ShipAPI ship = temp.get(0);
            if (TwigUtils.isMultiShip(ship))
            {
                out.add(ship);
                TwigUtils.filterConnections(ship, temp);
            }
            else
            {
                out.add(ship);
                temp.remove(0);
            }
        }
    }
    else
    {
        out = new ArrayList<>(list);
        Collections.sort(out, new SortShipsByDistance(loc));
    }
    return out;
}
项目:shadowyards    文件:MS_Utils.java   
public static boolean isWithinEmpRange(Vector2f loc, float dist, ShipAPI ship)
{
    float distSq = dist * dist;
    if (ship.getShield() != null && ship.getShield().isOn() && ship.getShield().isWithinArc(loc))
    {
        if (MathUtils.getDistance(ship.getLocation(), loc) - ship.getShield().getRadius() <= dist)
        {
            return true;
        }
    }

    for (WeaponAPI weapon : ship.getAllWeapons())
    {
        if (!weapon.getSlot().isHidden() && weapon.getSlot().getWeaponType() != WeaponType.DECORATIVE && weapon.getSlot().getWeaponType()
                != WeaponType.LAUNCH_BAY
                && weapon.getSlot().getWeaponType() != WeaponType.SYSTEM)
        {
            if (MathUtils.getDistanceSquared(weapon.getLocation(), loc) <= distSq)
            {
                return true;
            }
        }
    }

    for (ShipEngineAPI engine : ship.getEngineController().getShipEngines())
    {
        if (!engine.isSystemActivated())
        {
            if (MathUtils.getDistanceSquared(engine.getLocation(), loc) <= distSq)
            {
                return true;
            }
        }
    }

    return false;
}
项目:shadowyards    文件:MS_effectsHook.java   
public static void createFlakShockwave(Vector2f location)
{
    final LocalData localData = (LocalData) Global.getCombatEngine().getCustomData().get(DATA_KEY);
    if (localData == null)
    {
        return;
    }

    final List<Shockwave> shockwaves = localData.shockwaves;

    shockwaves.add(new Shockwave(location, FLAK_SHOCKWAVE_DURATION, FLAK_SHOCKWAVE_MAX_SCALE, FLAK_SHOCKWAVE_MIN_SCALE));
}
项目:shadowyards    文件:MS_effectsHook.java   
public static void createShockwave(Vector2f location)
{
    final LocalData localData = (LocalData) Global.getCombatEngine().getCustomData().get(DATA_KEY);
    if (localData == null)
    {
        return;
    }

    final List<Shockwave> shockwaves = localData.shockwaves;

    shockwaves.add(new Shockwave(location, CONCUSSION_SHOCKWAVE_DURATION, CONCUSSION_SHOCKWAVE_MAX_SCALE, CONCUSSION_SHOCKWAVE_MIN_SCALE));
}
项目:shadowyards    文件:MS_effectsHook.java   
public static void createEMPShockwave(Vector2f location)
{
    final LocalData localData = (LocalData) Global.getCombatEngine().getCustomData().get(DATA_KEY);
    if (localData == null)
    {
        return;
    }

    final List<Shockwave> shockwaves = localData.shockwaves;

    shockwaves.add(new Shockwave(location, EMP_SHOCKWAVE_DURATION, EMP_SHOCKWAVE_MAX_SCALE, EMP_SHOCKWAVE_MIN_SCALE));
}
项目:shadowyards    文件:MS_effectsHook.java   
public static void createPing(Vector2f location, Vector2f velocity)
{
    final LocalData localData = (LocalData) Global.getCombatEngine().getCustomData().get(DATA_KEY);
    if (localData == null)
    {
        return;
    }

    final List<tagPing> pings = localData.pings;

    pings.add(new tagPing(location, velocity, PING_DURATION, PING_MAX_SCALE, PING_MIN_SCALE));
}
项目:shadowyards    文件:MS_effectsHook.java   
public static void createPulse(Vector2f location)
{
    final LocalData localData = (LocalData) Global.getCombatEngine().getCustomData().get(DATA_KEY);
    if (localData == null)
    {
        return;
    }

    final List<swacsPulse> pulses = localData.pulses;

    pulses.add(new swacsPulse(location, PULSE_DURATION, PULSE_MAX_SCALE, PULSE_MIN_SCALE));
}
项目:shadowyards    文件:MS_effectsHook.java   
public static void createRift (Vector2f location) {
    final LocalData localData = (LocalData) Global.getCombatEngine().getCustomData().get(DATA_KEY);
    if (localData == null)
    {
        return;
    }

    final List<Rift> rifts = localData.rifts;

    rifts.add(new Rift(location, GAP_DURATION, GAP_MAX_SCALE, GAP_MIN_SCALE));
}
项目:shadowyards    文件:MS_effectsHook.java   
Shockwave(Vector2f location, float duration, float maxScale, float minScale)
{
    this.location = new Vector2f(location);
    alpha = 1f;
    facing = (float) Math.random() * 360f;
    maxLifespan = duration;
    lifespan = maxLifespan;
    this.maxScale = maxScale;
    this.minScale = minScale;
    scale = minScale;
}
项目:shadowyards    文件:MS_effectsHook.java   
tagPing(Vector2f location, Vector2f velocity, float duration, float maxScale, float minScale)
{
    this.location = new Vector2f(location);
    this.velocity = new Vector2f(velocity);
    alpha = 1f;
    facing = (float) Math.random() * 360f;
    maxLifespan = duration;
    lifespan = maxLifespan;
    this.maxScale = maxScale;
    this.minScale = minScale;
    scale = minScale;
}
项目:shadowyards    文件:MS_effectsHook.java   
swacsPulse(Vector2f location, float duration, float maxScale, float minScale)
{
    this.location = new Vector2f(location);
    alpha = 1f;
    facing = (float) Math.random() * 360f;
    maxLifespan = duration;
    lifespan = maxLifespan;
    this.maxScale = maxScale;
    this.minScale = minScale;
    scale = minScale;
}
项目:shadowyards    文件:MS_effectsHook.java   
Rift(Vector2f location, float duration, float maxScale, float minScale)
{
    this.location = new Vector2f(location);
    alpha = 1f;
    facing = (float) Math.random() * 360f;
    maxLifespan = duration;
    lifespan = maxLifespan;
    this.maxScale = maxScale;
    this.minScale = minScale;
    scale = minScale;
}
项目:shadowyards    文件:MS_barragoFlightTimeFixer.java   
@Override
public void advance(float amount, List<InputEventAPI> events) {
    if (engine == null) {
        return;
    }
    if (engine.isPaused()) {
        return;
    }

    List<MissileAPI> missiles = engine.getMissiles();
    int size = missiles.size();
    for (int i = 0; i < size; i++) {
        MissileAPI miss = missiles.get(i);
        String spec = miss.getProjectileSpecId();

        if (spec.contains(FAKE)) {
            Vector2f loc = miss.getLocation();
            Vector2f vel = miss.getVelocity();
            target = miss.getDamageTarget();

            for (int j = 0; j < 1; j++) {
                engine.spawnProjectile(miss.getSource(), miss.getWeapon(), REAL, loc, miss.getFacing(), vel);
                MissileAPI miss2 = missiles.get(i);
                String spec2 = miss2.getProjectileSpecId();
                Global.getSoundPlayer().playSound(SOUNDER, MathUtils.getRandomNumberInRange(0.9f, 1.1f), 0.6f, miss.getLocation(), ZERO);

                if (spec2.contains(REAL) && target == null) {
                    setTarget(target);
                    break;
                }
            }

            engine.removeEntity(miss);
        }
    }
}
项目:shadowyards    文件:MS_MissileMasher.java   
@Override
public boolean accept(MissileAPI missile)
{
    // Exclude missiles and our own side's shots
    if (missile instanceof DamagingProjectileAPI)
    {
        return false;
    }

    // Only include shots that are on a collision path with us
    // Also ensure they aren't travelling AWAY from us ;)
    return (CollisionUtils.getCollides(missile.getLocation(), Vector2f.add(missile.getLocation(), (Vector2f) new Vector2f(missile.getVelocity()).scale(
            SECONDS_TO_LOOK_AHEAD), null), proj.getLocation(), proj.getCollisionRadius())
            && Math.abs(MathUtils.getShortestRotation(missile.getFacing(), VectorUtils.getAngle(missile.getLocation(), proj.getLocation()))) <= 90f);
}
项目:shadowyards    文件:MS_MissileMasher.java   
@Override
public void advance(float amount, List<InputEventAPI> events) {
    if (Global.getCombatEngine().isPaused()) {
        return;
    }

    for (DamagingProjectileAPI proj : engine.getProjectiles()) {
        String spec = proj.getProjectileSpecId();

        // Check if missiles will get mashed
        if (!PROJ_IDS.contains(spec)) {
            continue;
        }

        float missileCrunchRadius = Math.max(proj.getCollisionRadius(), 20f);

        List<MissileAPI> missiles = CombatUtils.getMissilesWithinRange(proj.getLocation(), missileCrunchRadius);
        missiles = CollectionUtils.filter(missiles, filterMisses);

        for (MissileAPI missile : missiles) {
            Vector2f mLoc = missile.getLocation();

            if (!missiles.isEmpty()) {
                engine.applyDamage(missile, mLoc, 99999.0f, DamageType.ENERGY, 0.0f, true, false, null);
            }
        }
    }
}
项目:shadowyards    文件:MS_ArmorPiercePlugin.java   
@Override
public void renderInWorldCoords(ViewportAPI viewport) {
    if (engine == null) {
        return;
    }

    for (DamagingProjectileAPI proj : engine.getProjectiles()) {
        String spec = proj.getProjectileSpecId();

        if (!PROJ_IDS.contains(spec)) {
            continue;
        }

        Vector2f Here = new Vector2f(0,0) ;
        Here.x = proj.getLocation().x;
        Here.y = proj.getLocation().y;

        SpriteAPI sprite = Global.getSettings().getSprite("flare", "nidhoggr_ALF");

        if (!engine.isPaused()) {
            sprite.setAlphaMult(MathUtils.getRandomNumberInRange(0.9f, 1f));
        } else {
            float tAlf = sprite.getAlphaMult();
            sprite.setAlphaMult(tAlf);
        }
        sprite.setSize(800, 100);
        sprite.setAdditiveBlend();
        sprite.renderAtCenter(Here.x, Here.y);
    }
}
项目:shadowyards    文件:MS_PanShotFX.java   
@Override
public void advance(float amount, List<InputEventAPI> events) {
    for (DamagingProjectileAPI proj : Global.getCombatEngine().getProjectiles()) {
        Vector2f spawn = proj.getLocation();
        Vector2f explosionVelocity = (Vector2f) new Vector2f(proj.getVelocity()).scale(0.9f);

        if (!shots.contains(proj.getProjectileSpecId())) {
            continue;
        }

        for (int x = 0; x < explosionNum; x++) {
            Global.getCombatEngine().spawnExplosion(spawn, explosionVelocity, effectColor, 2f, explosionDur);
        }
    }
}