forked from decentraland/kernel-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
36 changed files
with
783 additions
and
720 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
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
*/ | ||
export enum UIValueType { | ||
PERCENT = 0, | ||
PIXELS = 1 | ||
PIXELS = 1, | ||
} | ||
|
||
/** | ||
|
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,37 @@ | ||
import { Component, ObservableComponent } from '../ecs/Component' | ||
import { AnimationState } from './animation/AnimationState' | ||
import { Shape } from './Shape' | ||
import { CLASS_ID } from './Components' | ||
/** | ||
* @public | ||
*/ | ||
@Component('engine.animator', CLASS_ID.ANIMATION) | ||
export class Animator extends Shape { | ||
@ObservableComponent.readonly | ||
private states: AnimationState[] = [] | ||
/** | ||
* Adds an AnimationState to the animation lists. | ||
*/ | ||
addClip(clip: AnimationState) { | ||
this.states.push(clip) | ||
clip.onChange(() => { | ||
this.dirty = true | ||
}) | ||
return this | ||
} | ||
/** | ||
* Gets the animation clip instance for the specified clip name. | ||
* If the clip doesn't exist a new one will be created. | ||
*/ | ||
getClip(clipName: string): AnimationState { | ||
for (let i = 0; i < this.states.length; i++) { | ||
const clip = this.states[i] | ||
if (clip.clip === clipName) { | ||
return clip | ||
} | ||
} | ||
const newClip = new AnimationState(clipName) | ||
this.addClip(newClip) | ||
return newClip | ||
} | ||
} |
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,21 @@ | ||
import { Component, ObservableComponent } from '../ecs/Component' | ||
import { CLASS_ID } from './Components' | ||
/** | ||
* Billboard defines a behavior that makes the entity face the camera in any moment. | ||
* @public | ||
*/ | ||
@Component('engine.billboard', CLASS_ID.BILLBOARD) | ||
export class Billboard extends ObservableComponent { | ||
@ObservableComponent.field | ||
x: boolean = true | ||
@ObservableComponent.field | ||
y: boolean = true | ||
@ObservableComponent.field | ||
z: boolean = true | ||
constructor(x: boolean = true, y: boolean = true, z: boolean = true) { | ||
super() | ||
this.x = x | ||
this.y = y | ||
this.z = z | ||
} | ||
} |
Oops, something went wrong.