|
|
@@ -51,7 +51,8 @@ export class FarmSystem {
|
|
|
|
|
|
/**获取可种植农田 */
|
|
|
private getCanPlantFarm(): FarmIcon | null {
|
|
|
- for (let i = 0; i < this.farms.length; i++) {
|
|
|
+ let len = this.farms.length;
|
|
|
+ for (let i = 0; i < len; i++) {
|
|
|
if (this.farms[i] != this.currSelectFarm && this.farms[i].data.state == FarmState.Empty) {
|
|
|
gData.gameData.nextCanProduct = gData.gameData.getRandomPlantConfig();
|
|
|
gData.gameData.nextMake = this.farms[i];
|
|
|
@@ -65,5 +66,15 @@ export class FarmSystem {
|
|
|
public btnMake() {
|
|
|
gData.gameData.nextMake.plant(gData.gameData.nextCanProduct.picture);
|
|
|
}
|
|
|
+
|
|
|
+ public setHarvest() {
|
|
|
+ let len = this.farms.length;
|
|
|
+ for (let i = 0; i < len; i++) {
|
|
|
+ if (this.farms[i].data.state == FarmState.Growing) {
|
|
|
+ this.farms[i].process.onSpeed();
|
|
|
+ this.farms[i].countDown.riped();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|