示例#1
0
  public void calScore(long timeStep) {
    // infrequent check on score. check status of game
    // increase or decrease increment for score(Never zero || < 0)
    // check is on game objects and delta of game objects

    if (model.getVirusCount() == 0 && tempVirusCount > 0) this.regEvent(GameScore.VIRUS_CLEAR);

    long hisTime = scoreStack[readScore].getTimeStamp();
    while ((runTime - hisTime) < MAX_TIME_FRAME) {
      if (readScore == curIndex) break;
      // this loops is crashing sometimes!
      hisTime = scoreStack[readScore].getTimeStamp();
      count[scoreStack[readScore].getEvent()] += 1;
      if (--readScore < 0) readScore = MAX_EVENTS - 1;
    }

    if (count[GameScore.VIRUS_CLEAR] > 0) scoreVel += (count[GameScore.VIRUS_CLEAR] * 0.4);
    else {
      scoreVel *= (0.4 * colFib(tempVirusCount));
    }
    if (count[GameScore.VIRUS_HIT] > 0) {
      scoreVel += (count[GameScore.VIRUS_HIT] * 0.4);
    }
    if (count[GameScore.ORGAN_HIT] > 0) {
      scoreVel += (count[GameScore.ORGAN_HIT] * 0.4);
    }
    if (count[GameScore.RED_BOUNDS] > 0) {
      scoreVel *= 0.7;
    }
    if (count[GameScore.FAT_BUST] > 0) {
      if (count[GameScore.FAT_BUST] > 6) scoreVel += (count[GameScore.VIRUS_HIT] * 1.4);
      else scoreVel += (count[GameScore.VIRUS_HIT] * 0.4);
    }
    if (count[GameScore.FAT_BUST_RICH] > 0) scoreVel += (count[GameScore.VIRUS_HIT] * 0.7);
    tempVirusCount = model.getVirusCount();

    resetCount();

    this.notifyObservers();
  }