示例#1
0
 // Will be used to transition into the dying state for animation, then after the animation set
 // dead = true
 public void kill(String source) {
   if (state != CrewStates.DYING) {
     Clock.log(name + " died by " + source + "!");
     state = CrewStates.DYING;
     deathTimer = System.currentTimeMillis();
   }
 }
示例#2
0
  public void damageHull(int damage) {
    Clock.log(getName() + " hull damaged " + damage);
    this.hull -= damage;

    if (hull < 0) hull = 0;

    if (hull == 0) {
      ShipDestroyedEvent event = new ShipDestroyedEvent(this);
      EVENT_BUS.post(event);

      if (!event.cancel) {
        kill();
      }
    }
  }
示例#3
0
  public void chargeFtlDrive(double dt) {
    if (ftlDriveCharge < 1 && getSystem("pilot").isManned()) {
      FTLChargeEvent event = new FTLChargeEvent(0.01);
      EVENT_BUS.post(event);

      if (!event.cancel) {
        ftlDriveCharge += dt * event.chargeRate;
      }

      if (ftlDriveCharge >= 1) {
        ftlDriveCharge = 1;
        Clock.log(getName() + " FTL Drive is charged");
      }
    }
  }
示例#4
0
 public void kill() {
   Clock.log(getName() + " was destroyed");
 }