Created
July 17, 2018 00:02
-
-
Save ZackDeRose/8b8c8139c1e2e96be9c834f210fa7026 to your computer and use it in GitHub Desktop.
Snippet for initial Level Up Logic for "AngularCDK Tables" article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
levelUp(heroName: string) { | |
const updatedHero = { ... this.heroes$.value[heroName] }; | |
updatedHero.attack++; | |
updatedHero.defense++; | |
updatedHero.speed++; | |
updatedHero.recovery++; | |
updatedHero.healing++; | |
updatedHero.health++; | |
const newHeroData = { ... this.heroes$.value }; | |
newHeroData[heroName] = updatedHero; | |
this.heroes$.next(newHeroData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment