uebung05 ende
This commit is contained in:
47
uebung05/src/logistics/Tank.java
Normal file
47
uebung05/src/logistics/Tank.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package logistics;
|
||||
|
||||
|
||||
import logistics.material.BulletBelts;
|
||||
import logistics.material.LiterDiesel;
|
||||
import logistics.material.ShellBatches;
|
||||
import logistics.quantities.NeedCollector;
|
||||
import logistics.storage.FloatStorage;
|
||||
import logistics.storage.IntStorage;
|
||||
|
||||
public class Tank extends Vehicle {
|
||||
public final IntStorage bullets;
|
||||
public final IntStorage shells;
|
||||
public final FloatStorage tank;
|
||||
|
||||
public Tank(String name, float diesel,int bulletBelts, int shellBatches) {
|
||||
super(name);
|
||||
bullets = new IntStorage(bulletBelts, BulletBelts.INSTANCE, 10);
|
||||
shells = new IntStorage(shellBatches, ShellBatches.INSTANCE, 10);
|
||||
tank = new FloatStorage(diesel, LiterDiesel.INSTANCE, 1200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportNeeds(NeedCollector collector) {
|
||||
super.reportNeedsSuper(collector);
|
||||
bullets.reportNeed(collector);
|
||||
shells.reportNeed(collector);
|
||||
tank.reportNeed(collector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillUpAll() {
|
||||
super.fillUpAllSuper();
|
||||
bullets.fillUp();
|
||||
shells.fillUp();
|
||||
tank.fillUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consumeAll(int intesity) {
|
||||
super.consumeAll();
|
||||
bullets.consume(intesity*2);
|
||||
tank.consume(intesity*180f);
|
||||
shells.consume(intesity*2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user