예제 #1
0
  public void init(float posX, float posY, int type, float angle) {
    this.type = type;

    float width = widths.get(type, 0.1f);
    float height = heights.get(type, 0.1f);

    bounds.set(posX - width / 2F, posY, width, height);
    position.set(posX - width / 2F, posY);
    velocity.set(0, speeds.get(type, 4f));
    velocity.setAngle(90f + angle);
    this.damage = damages.get(type, 2);
    alive = true;
    upgradeable = upgradeables.get(type);
  }
예제 #2
0
 public boolean equals(Object obj) {
   if (obj == this) return true;
   if (!(obj instanceof IntFloatMap)) return false;
   IntFloatMap other = (IntFloatMap) obj;
   if (other.size != size) return false;
   if (other.hasZeroValue != hasZeroValue) return false;
   if (hasZeroValue && other.zeroValue != zeroValue) {
     return false;
   }
   int[] keyTable = this.keyTable;
   float[] valueTable = this.valueTable;
   for (int i = 0, n = capacity + stashSize; i < n; i++) {
     int key = keyTable[i];
     if (key != EMPTY) {
       float otherValue = other.get(key, 0f);
       if (otherValue == 0f && !other.containsKey(key)) return false;
       float value = valueTable[i];
       if (otherValue != value) return false;
     }
   }
   return true;
 }
예제 #3
0
 public float getButtonAmount(int buttonCode) {
   return buttons.get(buttonCode, 0);
 }
예제 #4
0
 @Override
 public boolean getButton(int buttonCode) {
   return buttons.get(buttonCode, 0) >= 0.5f;
 }