angry-pixel 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +109 -42
- package/lib/index.esm.js +1 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -957,13 +957,18 @@ declare class EntityManager {
|
|
|
957
957
|
removeEntity(entity: Entity): void;
|
|
958
958
|
/**
|
|
959
959
|
* Removes all Entities and all their Components
|
|
960
|
+
* @param preserveComponentType Optional component type to preserve entities that have this component
|
|
960
961
|
* @public
|
|
961
962
|
* @example
|
|
962
963
|
* ```js
|
|
964
|
+
* // Remove all entities
|
|
963
965
|
* entityManager.removeAllEntities();
|
|
966
|
+
*
|
|
967
|
+
* // Remove all entities except those that have a SpriteRenderer component
|
|
968
|
+
* entityManager.removeAllEntities(SpriteRenderer);
|
|
964
969
|
* ```
|
|
965
970
|
*/
|
|
966
|
-
removeAllEntities(): void;
|
|
971
|
+
removeAllEntities(preserveComponentType?: ComponentType): void;
|
|
967
972
|
/**
|
|
968
973
|
* If the Entity exists, returns TRUE, otherwise it returns FALSE
|
|
969
974
|
* @param entity
|
|
@@ -1277,7 +1282,7 @@ declare class EntityManager {
|
|
|
1277
1282
|
* The third argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
|
|
1278
1283
|
* @param componentType The component class
|
|
1279
1284
|
* @param filter The filter function
|
|
1280
|
-
* @param includeDisabled TRUE to incluide disabled entities and components
|
|
1285
|
+
* @param includeDisabled TRUE to incluide disabled entities and components. Default is FALSE.
|
|
1281
1286
|
* @returns SearchResult
|
|
1282
1287
|
* @public
|
|
1283
1288
|
* @example
|
|
@@ -1309,7 +1314,7 @@ declare class EntityManager {
|
|
|
1309
1314
|
* This method returns a collection of objects of type SearchResult, which has the entity found, and the instance of the component.\
|
|
1310
1315
|
* The second argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
|
|
1311
1316
|
* @param componentType The component class
|
|
1312
|
-
* @param includeDisabled TRUE to incluide disabled entities and components
|
|
1317
|
+
* @param includeDisabled TRUE to incluide disabled entities and components. Default is FALSE.
|
|
1313
1318
|
* @returns SearchResult
|
|
1314
1319
|
* @public
|
|
1315
1320
|
* @example
|
|
@@ -1348,7 +1353,7 @@ declare class EntityManager {
|
|
|
1348
1353
|
* The third argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
|
|
1349
1354
|
* @param parent The parent entity
|
|
1350
1355
|
* @param componentType The component class
|
|
1351
|
-
* @param includeDisabled TRUE to incluide disabled entities and components
|
|
1356
|
+
* @param includeDisabled TRUE to incluide disabled entities and components. Default is FALSE.
|
|
1352
1357
|
* @returns SearchResult
|
|
1353
1358
|
* @public
|
|
1354
1359
|
* @example
|
|
@@ -1942,6 +1947,66 @@ declare class TimeManager {
|
|
|
1942
1947
|
clearAllIntervals(): void;
|
|
1943
1948
|
}
|
|
1944
1949
|
|
|
1950
|
+
/**
|
|
1951
|
+
* Manages scene loading, transitions and lifecycle.\
|
|
1952
|
+
* Provides methods to register scenes, load scenes by name, and handles the opening scene.\
|
|
1953
|
+
* Ensures proper cleanup between scene transitions and maintains scene state.
|
|
1954
|
+
* @public
|
|
1955
|
+
* @category Managers
|
|
1956
|
+
* @example
|
|
1957
|
+
* ```js
|
|
1958
|
+
* this.sceneManager.loadScene("MainScene");
|
|
1959
|
+
* ```
|
|
1960
|
+
*/
|
|
1961
|
+
declare class SceneManager {
|
|
1962
|
+
private readonly systemManager;
|
|
1963
|
+
private readonly systemFactory;
|
|
1964
|
+
private readonly entityManager;
|
|
1965
|
+
private readonly assetManager;
|
|
1966
|
+
private readonly timeManager;
|
|
1967
|
+
private readonly scenes;
|
|
1968
|
+
private openingSceneName;
|
|
1969
|
+
private currentSceneName;
|
|
1970
|
+
private sceneNameToBeLoaded;
|
|
1971
|
+
private _loadingScene;
|
|
1972
|
+
private _sceneLoadedThisFrame;
|
|
1973
|
+
private preserveEntitiesWithComponent;
|
|
1974
|
+
/** @internal */
|
|
1975
|
+
constructor(systemManager: SystemManager, systemFactory: CreateSystemService, entityManager: EntityManager, assetManager: AssetManager, timeManager: TimeManager);
|
|
1976
|
+
/**
|
|
1977
|
+
* Adds a scene to the SceneManager
|
|
1978
|
+
* @param sceneType The scene class
|
|
1979
|
+
* @param name The name of the scene
|
|
1980
|
+
* @param openingScene Whether the scene is the opening scene
|
|
1981
|
+
* @public
|
|
1982
|
+
*/
|
|
1983
|
+
addScene(sceneType: SceneType, name: string, openingScene?: boolean): void;
|
|
1984
|
+
/**
|
|
1985
|
+
* Loads a scene
|
|
1986
|
+
* @param name The name of the scene
|
|
1987
|
+
* @param preserveEntitiesWithComponent Optional component type to preserve entities that have this component
|
|
1988
|
+
* @public
|
|
1989
|
+
*/
|
|
1990
|
+
loadScene(name: string, preserveEntitiesWithComponent?: ComponentType): void;
|
|
1991
|
+
/**
|
|
1992
|
+
* Loads the opening scene
|
|
1993
|
+
* @public
|
|
1994
|
+
*/
|
|
1995
|
+
loadOpeningScene(): void;
|
|
1996
|
+
/**
|
|
1997
|
+
* Returns true if the scene is loading
|
|
1998
|
+
* @public
|
|
1999
|
+
*/
|
|
2000
|
+
get loadingScene(): boolean;
|
|
2001
|
+
/**
|
|
2002
|
+
* Returns true if the scene was loaded this frame
|
|
2003
|
+
* @public
|
|
2004
|
+
*/
|
|
2005
|
+
get sceneLoadedThisFrame(): boolean;
|
|
2006
|
+
/** @internal */
|
|
2007
|
+
update(): void;
|
|
2008
|
+
private destroyCurrentScene;
|
|
2009
|
+
}
|
|
1945
2010
|
/**
|
|
1946
2011
|
* This type represents a scene class
|
|
1947
2012
|
* @public
|
|
@@ -1965,14 +2030,14 @@ type SceneType<T extends Scene = Scene> = {
|
|
|
1965
2030
|
* this.assetManager.loadImage("image.png");
|
|
1966
2031
|
* }
|
|
1967
2032
|
*
|
|
1968
|
-
*
|
|
2033
|
+
* registerSystems() {
|
|
1969
2034
|
* this.systems.push(
|
|
1970
2035
|
* SomeSystem,
|
|
1971
2036
|
* AnotherSystem
|
|
1972
2037
|
* );
|
|
1973
2038
|
* }
|
|
1974
2039
|
*
|
|
1975
|
-
*
|
|
2040
|
+
* createEntities() {
|
|
1976
2041
|
* this.entityManager.createEntity([
|
|
1977
2042
|
* SomeComponent,
|
|
1978
2043
|
* AnotherComponent
|
|
@@ -1986,43 +2051,33 @@ declare abstract class Scene {
|
|
|
1986
2051
|
protected readonly assetManager: AssetManager;
|
|
1987
2052
|
systems: SystemType[];
|
|
1988
2053
|
constructor(entityManager: EntityManager, assetManager: AssetManager);
|
|
1989
|
-
|
|
2054
|
+
/**
|
|
2055
|
+
* Override this method to register the systems that will be executed in the scene
|
|
2056
|
+
* @public
|
|
2057
|
+
*/
|
|
2058
|
+
registerSystems(): void;
|
|
2059
|
+
/**
|
|
2060
|
+
* Override this method to load the assets needed for the scene
|
|
2061
|
+
* @public
|
|
2062
|
+
*/
|
|
1990
2063
|
loadAssets(): void;
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
private readonly assetManager;
|
|
2009
|
-
private readonly timeManager;
|
|
2010
|
-
private readonly scenes;
|
|
2011
|
-
private openingSceneName;
|
|
2012
|
-
private currentSceneName;
|
|
2013
|
-
private sceneNameToBeLoaded;
|
|
2014
|
-
private _loadingScene;
|
|
2015
|
-
private _sceneLoadedThisFrame;
|
|
2016
|
-
/** @internal */
|
|
2017
|
-
constructor(systemManager: SystemManager, systemFactory: CreateSystemService, entityManager: EntityManager, assetManager: AssetManager, timeManager: TimeManager);
|
|
2018
|
-
addScene(sceneType: SceneType, name: string, openingScene?: boolean): void;
|
|
2019
|
-
loadScene(name: string): void;
|
|
2020
|
-
loadOpeningScene(): void;
|
|
2021
|
-
get loadingScene(): boolean;
|
|
2022
|
-
get sceneLoadedThisFrame(): boolean;
|
|
2023
|
-
/** @internal */
|
|
2024
|
-
update(): void;
|
|
2025
|
-
private destroyCurrentScene;
|
|
2064
|
+
/**
|
|
2065
|
+
* Override this method to create the entities needed for the scene
|
|
2066
|
+
* @public
|
|
2067
|
+
*/
|
|
2068
|
+
createEntities(): void;
|
|
2069
|
+
/**
|
|
2070
|
+
* Adds a system to the scene
|
|
2071
|
+
* @param system The system to add
|
|
2072
|
+
* @public
|
|
2073
|
+
*/
|
|
2074
|
+
protected addSystem(system: SystemType): void;
|
|
2075
|
+
/**
|
|
2076
|
+
* Adds multiple systems to the scene
|
|
2077
|
+
* @param systems The systems to add
|
|
2078
|
+
* @public
|
|
2079
|
+
*/
|
|
2080
|
+
protected addSystems(systems: SystemType[]): void;
|
|
2026
2081
|
}
|
|
2027
2082
|
|
|
2028
2083
|
/**
|
|
@@ -2116,6 +2171,7 @@ declare class Game {
|
|
|
2116
2171
|
* const walkAnimation = new Animation({
|
|
2117
2172
|
* image: "walk.png",
|
|
2118
2173
|
* slice: { size: new Vector2(32, 32) },
|
|
2174
|
+
* frames: [0, 1, 2, 3, 4, 5],
|
|
2119
2175
|
* fps: 12,
|
|
2120
2176
|
* loop: true
|
|
2121
2177
|
* });
|
|
@@ -2123,6 +2179,7 @@ declare class Game {
|
|
|
2123
2179
|
* const idleAnimation = new Animation({
|
|
2124
2180
|
* image: "idle.png",
|
|
2125
2181
|
* slice: { size: new Vector2(32, 32) },
|
|
2182
|
+
* frames: [6, 7, 8, 9]
|
|
2126
2183
|
* fps: 8,
|
|
2127
2184
|
* loop: true
|
|
2128
2185
|
* });
|
|
@@ -2154,6 +2211,7 @@ interface AnimatorOptions {
|
|
|
2154
2211
|
* const walkAnimation = new Animation({
|
|
2155
2212
|
* image: "walk.png",
|
|
2156
2213
|
* slice: { size: new Vector2(32, 32) },
|
|
2214
|
+
* frames: [0, 1, 2, 3, 4, 5],
|
|
2157
2215
|
* fps: 12,
|
|
2158
2216
|
* loop: true
|
|
2159
2217
|
* });
|
|
@@ -2161,6 +2219,7 @@ interface AnimatorOptions {
|
|
|
2161
2219
|
* const idleAnimation = new Animation({
|
|
2162
2220
|
* image: "idle.png",
|
|
2163
2221
|
* slice: { size: new Vector2(32, 32) },
|
|
2222
|
+
* frames: [6, 7, 8, 9],
|
|
2164
2223
|
* fps: 8,
|
|
2165
2224
|
* loop: true
|
|
2166
2225
|
* });
|
|
@@ -2199,6 +2258,7 @@ declare class Animator {
|
|
|
2199
2258
|
* const walkAnimation = new Animation({
|
|
2200
2259
|
* image: "walk.png",
|
|
2201
2260
|
* slice: { size: new Vector2(32, 32) },
|
|
2261
|
+
* frames: [0, 1, 2, 3, 4, 5],
|
|
2202
2262
|
* fps: 12,
|
|
2203
2263
|
* loop: true
|
|
2204
2264
|
* });
|
|
@@ -2206,6 +2266,7 @@ declare class Animator {
|
|
|
2206
2266
|
* const idleAnimation = new Animation({
|
|
2207
2267
|
* image: "idle.png",
|
|
2208
2268
|
* slice: { size: new Vector2(32, 32) },
|
|
2269
|
+
* frames: [6, 7, 8, 9],
|
|
2209
2270
|
* fps: 8,
|
|
2210
2271
|
* loop: true
|
|
2211
2272
|
* });
|
|
@@ -2242,6 +2303,7 @@ interface AnimationOptions {
|
|
|
2242
2303
|
* const walkAnimation = new Animation({
|
|
2243
2304
|
* image: "walk.png",
|
|
2244
2305
|
* slice: { size: new Vector2(32, 32) },
|
|
2306
|
+
* frames: [0, 1, 2, 3, 4, 5],
|
|
2245
2307
|
* fps: 12,
|
|
2246
2308
|
* loop: true
|
|
2247
2309
|
* });
|
|
@@ -2249,6 +2311,7 @@ interface AnimationOptions {
|
|
|
2249
2311
|
* const idleAnimation = new Animation({
|
|
2250
2312
|
* image: "idle.png",
|
|
2251
2313
|
* slice: { size: new Vector2(32, 32) },
|
|
2314
|
+
* frames: [6, 7, 8, 9],
|
|
2252
2315
|
* fps: 8,
|
|
2253
2316
|
* loop: true
|
|
2254
2317
|
* });
|
|
@@ -2301,6 +2364,8 @@ interface AudioPlayerOptions {
|
|
|
2301
2364
|
action: AudioPlayerAction;
|
|
2302
2365
|
/** The audio source to play. */
|
|
2303
2366
|
audioSource: HTMLAudioElement | string;
|
|
2367
|
+
/** TRUE If the audio source should stop on scene transition, FALSE otherwise. Default is TRUE. */
|
|
2368
|
+
stopOnSceneTransition: boolean;
|
|
2304
2369
|
/** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
|
|
2305
2370
|
fixedToTimeScale: boolean;
|
|
2306
2371
|
/** TRUE If the audio source should loop. */
|
|
@@ -2328,6 +2393,8 @@ declare class AudioPlayer {
|
|
|
2328
2393
|
action: AudioPlayerAction;
|
|
2329
2394
|
/** The audio source to play. */
|
|
2330
2395
|
audioSource: HTMLAudioElement | string;
|
|
2396
|
+
/** TRUE If the audio source should stop on scene transition, FALSE otherwise. Default is TRUE. */
|
|
2397
|
+
stopOnSceneTransition: boolean;
|
|
2331
2398
|
/** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
|
|
2332
2399
|
fixedToTimeScale: boolean;
|
|
2333
2400
|
/** TRUE If the audio source should loop. */
|