-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into protocol-squad
Signed-off-by: Lean Mendoza <[email protected]>
- Loading branch information
Showing
37 changed files
with
616 additions
and
2,148 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
54 changes: 54 additions & 0 deletions
54
packages/@dcl/ecs/src/components/extended/VirtualCamera.ts
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,54 @@ | ||
import { IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine' | ||
import { PBVirtualCamera, VirtualCamera } from '../generated/index.gen' | ||
import { CameraTransition } from '../generated/pb/decentraland/sdk/components/common/camera_transition.gen' | ||
|
||
/** | ||
* @public | ||
*/ | ||
export interface CameraTransitionHelper { | ||
/** | ||
* @returns a CameraTransition speed | ||
*/ | ||
Speed: (speed: number) => CameraTransition['transitionMode'] | ||
/** | ||
* @returns a CameraTransition time | ||
*/ | ||
Time: (time: number) => CameraTransition['transitionMode'] | ||
} | ||
|
||
/** | ||
* @public | ||
*/ | ||
export interface VirtualCameraComponentDefinitionExtended | ||
extends LastWriteWinElementSetComponentDefinition<PBVirtualCamera> { | ||
/** | ||
* Camera transition helper for time and speed modes | ||
*/ | ||
Transition: CameraTransitionHelper | ||
} | ||
|
||
const CameraTransitionHelper: CameraTransitionHelper = { | ||
Speed(speed) { | ||
return { | ||
$case: 'speed' as const, | ||
speed | ||
} | ||
}, | ||
Time(time) { | ||
return { | ||
$case: 'time' as const, | ||
time | ||
} | ||
} | ||
} | ||
|
||
export function defineVirtualCameraComponent( | ||
engine: Pick<IEngine, 'defineComponentFromSchema'> | ||
): VirtualCameraComponentDefinitionExtended { | ||
const theComponent = VirtualCamera(engine) | ||
|
||
return { | ||
...theComponent, | ||
Transition: CameraTransitionHelper | ||
} | ||
} |
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
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.