This server is intended for use for Academic Classwork related Git repositories only. Projects/repositories will generally be removed after 6 months following close of the semester. Inactive repositories from previous semester are now being archived when no activity for 365 days. They are renamed and marked as 'archived'. After 90 days in that state they will be removed from the system completely.

Commit 3d741d84 authored by Pamela Petterchak's avatar Pamela Petterchak

accumulator

parent 08fc5cd5
<button mat-raised-button>
<img src="assets/PickleJar.png" (click)="jarUpgrade()" />
</button>
......
......@@ -11,9 +11,7 @@ export class AccumulatorsComponent {
readonly clickMulti = this.service.incrementsClicksVal;
readonly accumulatesMulti = this.service.accumulatesVal;
constructor(private service: GamePlayService) { }
// intervalID = setInterval(() => this.service.accumulate(), 1000);
constructor(private service: GamePlayService) {}
jarUpgrade() {
this.service.jarUpgrade().catch((err) => console.log(err));
......@@ -30,4 +28,4 @@ export class AccumulatorsComponent {
reservoirUpgrade() {
this.service.reservoirUpgrade().catch((err) => console.log(err));
}
}
\ No newline at end of file
}
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { GamePlayService } from './game-play.service';
@Component({
selector: 'app-game-play',
templateUrl: './game-play.component.html',
styleUrls: ['./game-play.component.scss'],
})
export class GamePlayComponent {}
export class GamePlayComponent implements OnInit {
constructor(private service: GamePlayService) {}
ngOnInit() {
this.service.accumulate().catch((err) => console.log(err));
}
}
......@@ -51,9 +51,12 @@ export class GamePlayService {
}
}
accumulate() {
while (this.pickles.value < 100000000) {
async accumulate() {
const accumulator = setInterval(() => {
this.pickles.next(this.pickles.value + this.accumulates.value);
}
if (this.pickles.value >= 100000000) {
clearInterval(accumulator);
}
}, 3000);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment