It works, don't know why

This commit is contained in:
2023-02-04 11:23:43 +02:00
parent 9d3f27b49e
commit 2a38098d1c
21 changed files with 508 additions and 149 deletions

View File

@@ -0,0 +1,30 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {PlantDto} from "../plant.dto";
import {PlayerService} from "../player.service";
import Plant from "../Plant";
@Component({
selector: 'app-farmer-container',
templateUrl: './farmer-container.component.html',
styleUrls: ['./farmer-container.component.scss'],
})
export class FarmerContainerComponent implements OnInit {
@Input('plant') plant!: Plant;
constructor(private playerService: PlayerService) { }
getPrice() {
if (!this.plant) return 0;
return this.plant.getPlantData().farmer.price;
}
buy() {
this.playerService.buyFarmer(this.plant.id);
}
canAfford(): boolean {
return this.playerService.canAffordFarmer(this.plant.id);
}
ngOnInit() {}
}