예제 #1
0
  public Ship(
      String appearanceLocation,
      float collisionScale,
      World world,
      float startX,
      float startY,
      float maxV,
      ArrayList<ViewedCollidable> aliveThings,
      int factionCode) {
    super(appearanceLocation, collisionScale, world, startX, startY, aliveThings, factionCode);
    // TODO Auto-generated constructor stub
    m_maxVelocity = maxV;
    me = new InertialManeuverEngine(this, maxV);
    ce = new ConventionalCruiseEngine(this, maxV);
    m_aliveThings = aliveThings;

    m_shieldEffect.load(
        Gdx.files.internal("data/shield.p"),
        Gdx.files.internal("data/" + appearanceLocation + "/"));
    m_shieldEffectPool = new ParticleEffectPool(m_shieldEffect, 1, 2);
    m_pooledShieldEffect = m_shieldEffectPool.obtain();

    m_starSlingEnterEffect.load(
        Gdx.files.internal("data/starsling.p"), Gdx.files.internal("data/"));
    m_starSlingEnterEffectPool = new ParticleEffectPool(m_starSlingEnterEffect, 1, 2);
    m_pooledStarSlingEnterEffect = m_starSlingEnterEffectPool.obtain();

    m_starSlingExitEffect.load(
        Gdx.files.internal("data/starslingexit.p"), Gdx.files.internal("data/"));
    m_starSlingExitEffectPool = new ParticleEffectPool(m_starSlingExitEffect, 1, 2);
    m_pooledStarSlingExitEffect = m_starSlingExitEffectPool.obtain();

    float radius = Math.max(m_objectAppearance.getWidth(), m_objectAppearance.getHeight());
    m_pooledStarSlingEnterEffect.getEmitters().get(0).getSpawnHeight().setHigh(radius);
    m_pooledStarSlingEnterEffect.getEmitters().get(0).getSpawnWidth().setHigh(radius);
    m_pooledStarSlingEnterEffect.getEmitters().get(1).getScale().setHigh(radius * 2);
    m_pooledStarSlingEnterEffect.getEmitters().get(1).getScale().setLow(radius);
    m_pooledStarSlingEnterEffect.reset();

    m_pooledStarSlingExitEffect.getEmitters().get(0).getSpawnHeight().setHigh(radius);
    m_pooledStarSlingExitEffect.getEmitters().get(0).getSpawnWidth().setHigh(radius);
    m_pooledStarSlingExitEffect.getEmitters().get(1).getScale().setHigh(radius * 2);
    m_pooledStarSlingExitEffect.getEmitters().get(1).getScale().setLow(radius);
    m_pooledStarSlingExitEffect.reset();

    m_detectionRange = 50f;
    m_font = new BitmapFont(Gdx.files.internal("data/font16.fnt"), false);
    m_shieldDamageReductions[DamageType.Energy.value] = 1f;
  }
예제 #2
0
  @Override
  public void Draw(SpriteBatch renderer) {
    super.Draw(renderer);
    if (!m_inMenu) {

      m_detectionRange = m_detectionRangeReset;
      SetShieldColor();
      m_pooledShieldEffect.setPosition(m_objectXPosition, m_objectYPosition);
      m_pooledShieldEffect.getEmitters().get(0).getRotation().setHigh((float) m_angleDegrees);
      m_pooledShieldEffect.getEmitters().get(0).getRotation().setLow((float) m_angleDegrees);
      m_pooledShieldEffect.draw(renderer, 1f / 60f);

      DrawHackedIndicator(renderer);
      for (int i = 0; i < m_overTimeEffects.size(); i++) {
        OverTimeEffect e = m_overTimeEffects.get(i);
        if (!e.Action()) {
          m_overTimeEffects.remove(e);
        }
      }

      if (!m_freezeShip) {
        if (m_weaponsFree > 0) {
          ProcessCounterMeasures(renderer);
        } else {
          StopCounterMeasureSound();
        }
        ce.Draw(renderer);
        me.Draw(renderer);
        HandleShieldRecharging();
        HandleBoostRecharge();
      }
    }

    super.Draw(renderer);
  }
예제 #3
0
  private void SetShieldColor() {
    float[] r = {1, 1, 1, 1};
    float shieldPercent = m_shieldIntegrity / 1000f;

    if (m_isEthereal) {
      // blue
      r[0] = .1f;
      r[1] = .75f;
      r[2] = 1f;
    } else if (shieldPercent > .9f) {
      // white
      r[0] = 1f;
      r[1] = 1f;
      r[2] = 1f;
    } else if (shieldPercent > .75f) {
      // blue
      r[0] = .1f;
      r[1] = .95f;
      r[2] = .1f;
    } else if (shieldPercent > .5f) {
      // yellow
      r[0] = 1f;
      r[1] = 1f;
      r[2] = .25f;
    } else if (shieldPercent > .3f) {
      // orange
      r[0] = 1f;
      r[1] = .25f;
      r[2] = .1f;
    } else if (shieldPercent > 0f) {
      // red
      r[0] = 1f;
      r[1] = 0f;
      r[2] = 0f;
    } else {
      // black no shields
      r[0] = 0f;
      r[1] = 0f;
      r[2] = 0f;
    }

    m_pooledShieldEffect.getEmitters().get(0).getTint().setColors(r);
  }