-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
889687b
commit 63c3f45
Showing
33 changed files
with
491 additions
and
83 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Resource from '../resource'; | ||
|
||
import { Modules } from '@kaetram/common/network'; | ||
|
||
import type { Frame } from '../../../animation'; | ||
import type Sprite from '../../../sprite'; | ||
|
||
export default class Tree extends Resource { | ||
public baseFrame!: Frame; | ||
public exhaustedFrame!: Frame; | ||
|
||
public constructor(instance: string) { | ||
super(instance, Modules.EntityType.Tree); | ||
} | ||
|
||
/** | ||
* Override for the set sprite that computes the base frame and the stump frame. | ||
* @param sprite The sprite that we are setting. | ||
*/ | ||
|
||
public override setSprite(sprite: Sprite): void { | ||
super.setSprite(sprite); | ||
|
||
this.baseFrame = this.sprite.animations.exhausted.frame; | ||
this.exhaustedFrame = this.sprite.animations.exhausted.getSecondFrame(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import Entity from '../../entity'; | ||
|
||
import type { Modules } from '@kaetram/common/network'; | ||
|
||
export default abstract class Resource extends Entity { | ||
public exhausted = false; | ||
|
||
public constructor(instance: string, type: Modules.EntityType) { | ||
super(instance, type); | ||
} | ||
|
||
/** | ||
* Plays the shake animation for the resource. | ||
*/ | ||
|
||
public shake(): void { | ||
this.setAnimation('shake', 150, 1, () => { | ||
this.idle(); | ||
}); | ||
} | ||
|
||
/** | ||
* Override for the animation frame to use for the tree. | ||
*/ | ||
|
||
public override idle(): void { | ||
this.setAnimation(this.exhausted ? 'exhausted' : 'idle', 150, 1, () => { | ||
// | ||
}); | ||
} | ||
|
||
/** | ||
* Override for the `updateSilhouette` function to bypass drawing any silhouette | ||
* around the resource if it is exhausted. | ||
* @param state The state of the silhouette. | ||
*/ | ||
|
||
public override updateSilhouette(state?: boolean): void { | ||
if (this.exhausted) { | ||
this.silhouette = false; | ||
return; | ||
} | ||
|
||
super.updateSilhouette(state); | ||
} | ||
|
||
/** | ||
* Used for a resource to alternate between an exhausted state (just the empty | ||
* resource) or its default idle state. | ||
* @param state The new state of the resource. | ||
*/ | ||
|
||
public setExhausted(state = false): void { | ||
this.exhausted = state; | ||
|
||
this.idle(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.