()
| 72 | } |
| 73 | |
| 74 | private buySelectedItem(): void{ |
| 75 | // If we have enough candies to buy it |
| 76 | if(this.getGame().getCandies().getCurrent() >= this.items[this.selectedItemIndex].getPrice()){ |
| 77 | // We pay the price |
| 78 | this.getGame().getCandies().add(-this.items[this.selectedItemIndex].getPrice()); |
| 79 | // We tell the item that we just bought it |
| 80 | this.items[this.selectedItemIndex].buy(); |
| 81 | // No more selected item |
| 82 | this.selectedItemIndex = null; |
| 83 | // We update |
| 84 | this.update(); |
| 85 | this.getGame().updatePlace(); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | private clickedOnItem(index: number): void{ |
| 90 | // Set the currently selected item index |
nothing calls this directly
no test coverage detected