@sorskoot/wonderland-components
v1.6.2
Published
Collection of personal components for Wonderland Engine
Downloads
28
Maintainers
Readme
Sorskoot's Wonderland Components Collection
This repository contains a collection of components, utilities, and shaders that Sorskoot personally uses in his Wonderland Engine projects. This collection aims to help other developers quickly get started with their own projects by providing reusable code.
Components are added to NPM to make it a bit easier to use the library.
Components
Core Components
- SelfDestruct - Destroys an object after a specified time. Perfect for temporary effects or objects.
- DieAfterTime - Similar to SelfDestruct but starts inactive by default, ideal for prefabs that need to be manually triggered.
- FadeToBlack - Creates screen transitions by fading to and from black (or any color). Useful for level transitions or scene changes.
- Flipbook - Animates textures from a sprite sheet. Great for animated effects, UI elements, or simple character animations.
- SnapRotate - Provides snap-based rotation for VR experiences. Helps reduce motion sickness by allowing users to rotate in fixed increments.
- SnowParticles - Creates a snow particle effect. Perfect for winter scenes or atmospheric effects.
- StartStopAnimationOnActivate - Controls animations based on object activation state. Useful for interactive elements.
- Tags - A lightweight tagging system for objects. Helps with object identification and filtering.
- TeleportController - Handles teleportation mechanics for VR experiences. Essential for comfortable VR locomotion.
Simple Animations
- SimpleAnimationBase - Base class for simple animation components. Provides common functionality for animation components.
- TweenPositionAnimation - Animates an object's position between two points. Great for moving platforms, doors, or UI elements.
- TweenScaleAnimation - Animates an object's scale. Perfect for growing/shrinking effects or attention-grabbing UI.
Input
- InputManager - Manages input from various sources. Provides a unified input system for your application.
- KeyboardController - Handles keyboard input for desktop experiences. Useful for testing or non-VR applications.
Prefab System
- PrefabBase - Base class for creating prefab components. Provides common functionality for prefab management.
Combat/Interaction
- ShootBase - Base component for shooting mechanics. Can be extended for various weapon types.
AtomECS
The start of a very simplistic ECS system. There is some documentation in the code. Examples will follow.
Service Locator
The ServiceLocator can be used to make singletons from classes and Wonderland Components.
Add the @ServiceLocator.register to classes or @ServiceLocator.registerComponent to Wonderland Engine Components. This will make sure that the class or component is registered with the ServiceLocator at the right time (either in the constructor or in the init() method).
@ServiceLocator.register
export class GameManager {
// implementation
}
or
@ServiceLocator.registerComponent
export class MyComponent extends Component{
// implementation
}To use a singleton, you can either do:
const myComponent = ServiceLocator.get(MyComponent);
const myManager = ServiceLocator.get(GameManager);or inject directly into a property:
@ServiceLocator.inject(MyComponent)
private declare _myComponent: MyComponent;Utilities
The library also includes various utility classes for:
- Coroutine management
- Mathematics helpers (Lerp, Noise, RNG)
- Object caching
- Signal systems
- Haptic feedback
- And much more!
