angry-pixel 1.1.1 → 1.1.2
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/lib/component/Animator.d.ts +3 -2
- package/lib/component/AudioPlayer.d.ts +6 -4
- package/lib/component/Camera.d.ts +1 -2
- package/lib/component/RigidBody.d.ts +5 -4
- package/lib/component/Transform.d.ts +4 -5
- package/lib/component/collider/BallCollider.d.ts +3 -2
- package/lib/component/collider/BoxCollider.d.ts +3 -2
- package/lib/component/collider/Collider.d.ts +6 -1
- package/lib/component/collider/EdgeCollider.d.ts +7 -4
- package/lib/component/collider/PolygonCollider.d.ts +7 -4
- package/lib/component/collider/TilemapCollider.d.ts +3 -2
- package/lib/component/rendering/MaskRenderer.d.ts +3 -2
- package/lib/component/rendering/SpriteRenderer.d.ts +6 -5
- package/lib/component/rendering/TextRenderer.d.ts +3 -2
- package/lib/component/rendering/tilemap/CsvTilemapRenderer.d.ts +6 -6
- package/lib/component/rendering/tilemap/TiledTilemapRenderer.d.ts +10 -5
- package/lib/component/rendering/tilemap/TilemapRenderer.d.ts +9 -7
- package/lib/core/Component.d.ts +41 -86
- package/lib/core/Game.d.ts +10 -14
- package/lib/core/GameActor.d.ts +66 -0
- package/lib/core/GameObject.d.ts +53 -94
- package/lib/core/Scene.d.ts +6 -65
- package/lib/core/facades/GameObjectManagerFacade.d.ts +35 -25
- package/lib/core/facades/TimeManagerFacade.d.ts +1 -0
- package/lib/core/managers/GameObjectManager.d.ts +11 -10
- package/lib/core/managers/IterationManager copy.d.ts +42 -0
- package/lib/core/managers/IterationManager.d.ts +11 -6
- package/lib/core/managers/IterationManagerOld.d.ts +42 -0
- package/lib/core/managers/SceneManager.d.ts +2 -2
- package/lib/core/managers/TimeManager.d.ts +10 -6
- package/lib/gameObject/GameCamera.d.ts +2 -2
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/input/GamepadController.d.ts +16 -4
- package/lib/math/Utils.d.ts +8 -2
- package/lib/physics/collision/CollisionManager.d.ts +7 -3
- package/lib/physics/collision/resolver/AABBResolver.d.ts +2 -2
- package/lib/physics/collision/resolver/SatResolver.d.ts +1 -2
- package/lib/physics/rigodBody/RigidBodyData.d.ts +2 -1
- package/lib/physics/rigodBody/RigidBodyManager.d.ts +4 -1
- package/lib/rendering/renderData/TextRenderData.d.ts +1 -1
- package/package.json +1 -1
package/lib/core/Game.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SceneClass } from "../core/managers/SceneManager";
|
|
2
2
|
import { Container } from "../utils/Container";
|
|
3
3
|
import { Rectangle } from "../math/Rectangle";
|
|
4
4
|
import { Vector2 } from "../math/Vector2";
|
|
5
|
+
import { CollisionMatrix } from "../physics/collision/CollisionManager";
|
|
5
6
|
export declare const container: Container;
|
|
6
7
|
export interface GameConfig {
|
|
7
8
|
containerNode: HTMLElement | null;
|
|
@@ -16,6 +17,7 @@ export interface GameConfig {
|
|
|
16
17
|
quadTreeBounds?: Rectangle | null;
|
|
17
18
|
quadMaxLevel?: number;
|
|
18
19
|
collidersPerQuad?: number;
|
|
20
|
+
collisionMatrix?: CollisionMatrix;
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
export declare enum CollisionMethodConfig {
|
|
@@ -24,12 +26,8 @@ export declare enum CollisionMethodConfig {
|
|
|
24
26
|
}
|
|
25
27
|
export declare class Game {
|
|
26
28
|
private sceneManager;
|
|
27
|
-
private renderManager;
|
|
28
29
|
private iterationManager;
|
|
29
30
|
private _config;
|
|
30
|
-
private _running;
|
|
31
|
-
private _stop;
|
|
32
|
-
private frameRequestId;
|
|
33
31
|
constructor(config: GameConfig);
|
|
34
32
|
private setupManagers;
|
|
35
33
|
/**
|
|
@@ -43,11 +41,11 @@ export declare class Game {
|
|
|
43
41
|
/**
|
|
44
42
|
* Add a scene to the game
|
|
45
43
|
*
|
|
44
|
+
* @param sceneClass the class of the scene
|
|
46
45
|
* @param name The name of the scene
|
|
47
|
-
* @param
|
|
48
|
-
* @param openingScene If this is the opening scene, set TRUE, FALSE instead
|
|
46
|
+
* @param openingScene [default FALSE] If this is the opening scene, set TRUE, FALSE instead
|
|
49
47
|
*/
|
|
50
|
-
addScene(
|
|
48
|
+
addScene(sceneClass: SceneClass, name: string, openingScene?: boolean): void;
|
|
51
49
|
/**
|
|
52
50
|
* Run the game
|
|
53
51
|
*/
|
|
@@ -56,14 +54,12 @@ export declare class Game {
|
|
|
56
54
|
* Stop the game
|
|
57
55
|
*/
|
|
58
56
|
stop(): void;
|
|
59
|
-
private gameLoop;
|
|
60
57
|
/**
|
|
61
|
-
* Pauses the game
|
|
58
|
+
* Pauses the game
|
|
62
59
|
*/
|
|
63
|
-
|
|
60
|
+
pause(): void;
|
|
64
61
|
/**
|
|
65
|
-
* Resumes the paused game
|
|
62
|
+
* Resumes the paused game
|
|
66
63
|
*/
|
|
67
|
-
|
|
68
|
-
private requestAnimationFrame;
|
|
64
|
+
resume(): void;
|
|
69
65
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { GameObject, GameObjectClass } from "./GameObject";
|
|
2
|
+
import { GameObjectManager } from "./managers/GameObjectManager";
|
|
3
|
+
import { FrameEvent } from "./managers/IterationManager";
|
|
4
|
+
export interface InitOptions {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class GameActor {
|
|
8
|
+
protected readonly gameObjectManager: GameObjectManager;
|
|
9
|
+
protected readonly updateEvent: FrameEvent;
|
|
10
|
+
private started;
|
|
11
|
+
dispatch(event: FrameEvent, options?: InitOptions): void;
|
|
12
|
+
/**
|
|
13
|
+
* This method is called after instantiation (recommended for the creation of game objects).
|
|
14
|
+
*/
|
|
15
|
+
protected init?(options?: InitOptions): void;
|
|
16
|
+
/**
|
|
17
|
+
* This method is called only once on the first available frame.
|
|
18
|
+
*/
|
|
19
|
+
protected start?(): void;
|
|
20
|
+
/**
|
|
21
|
+
* This method is called on every frame.
|
|
22
|
+
*/
|
|
23
|
+
protected update?(): void;
|
|
24
|
+
/**
|
|
25
|
+
* This method is called before destruction.
|
|
26
|
+
*/
|
|
27
|
+
protected onDestroy?(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Adds a new game object to the scene.
|
|
30
|
+
* @param gameObjectClass The game object class
|
|
31
|
+
* @param options [optional] This options will be passed to the init method
|
|
32
|
+
* @param name [optional] The name of the game object
|
|
33
|
+
* @returns The added game object
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, name?: string): T;
|
|
37
|
+
/**
|
|
38
|
+
* Returns all the game objects in the scene.
|
|
39
|
+
* @returns The found game objects
|
|
40
|
+
*/
|
|
41
|
+
protected findGameObjects(): GameObject[];
|
|
42
|
+
/**
|
|
43
|
+
* Returns the first game object found for the given class, or undefined otherwise.
|
|
44
|
+
* @param gameObjectClass The game object class to find
|
|
45
|
+
* @returns The found game object
|
|
46
|
+
*/
|
|
47
|
+
findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the first game object found for the given name, or undefined otherwise.
|
|
50
|
+
* @param name The name of the game object to find
|
|
51
|
+
* @returns The found game object
|
|
52
|
+
*/
|
|
53
|
+
findGameObject<T extends GameObject>(name: string): T;
|
|
54
|
+
/**
|
|
55
|
+
* Returns a collection of game objects found for the given tag
|
|
56
|
+
* @param tag The tag of the game objects to find
|
|
57
|
+
* @returns The found game objects
|
|
58
|
+
*/
|
|
59
|
+
protected findGameObjectsByTag<T extends GameObject>(tag: string): T[];
|
|
60
|
+
/**
|
|
61
|
+
* Destroy the given game object
|
|
62
|
+
* @param gameObject The game object to destory
|
|
63
|
+
*/
|
|
64
|
+
protected destroyGameObject(gameObject: GameObject): void;
|
|
65
|
+
protected abstract _destroy(): void;
|
|
66
|
+
}
|
package/lib/core/GameObject.d.ts
CHANGED
|
@@ -1,133 +1,102 @@
|
|
|
1
|
-
import { Component } from "./Component";
|
|
1
|
+
import { Component, ComponentClass } from "./Component";
|
|
2
2
|
import { Transform } from "../component/Transform";
|
|
3
3
|
import { RigidBody } from "../component/RigidBody";
|
|
4
|
-
import { GameObjectFactory } from "../core/managers/GameObjectManager";
|
|
5
4
|
import { Scene } from "./Scene";
|
|
6
|
-
import {
|
|
5
|
+
import { GameActor, InitOptions } from "./GameActor";
|
|
7
6
|
export declare const LAYER_DEFAULT = "Default";
|
|
8
|
-
export declare type
|
|
9
|
-
export declare class GameObject {
|
|
7
|
+
export declare type GameObjectClass<T extends GameObject = GameObject> = new (name?: string, parent?: GameObject) => T;
|
|
8
|
+
export declare class GameObject extends GameActor {
|
|
10
9
|
readonly id: string;
|
|
11
|
-
name: string;
|
|
10
|
+
readonly name: string;
|
|
12
11
|
tag: string;
|
|
13
12
|
layer: string;
|
|
14
13
|
ui: boolean;
|
|
15
14
|
keep: boolean;
|
|
15
|
+
parent: GameObject | null;
|
|
16
16
|
private _active;
|
|
17
|
-
private _parent;
|
|
18
|
-
private started;
|
|
19
17
|
private sceneManager;
|
|
20
|
-
private gameObjectManager;
|
|
21
18
|
private components;
|
|
22
|
-
|
|
19
|
+
private activeComponentsCache;
|
|
20
|
+
private activeChildrenCache;
|
|
21
|
+
constructor(name?: string, parent?: GameObject);
|
|
23
22
|
get active(): boolean;
|
|
24
|
-
|
|
23
|
+
set active(active: boolean);
|
|
24
|
+
private updateComponentsActiveStatus;
|
|
25
|
+
private updateChildrenActiveStatus;
|
|
25
26
|
get transform(): Transform;
|
|
26
27
|
get rigidBody(): RigidBody;
|
|
27
|
-
get parent(): GameObject | null;
|
|
28
|
-
set parent(parent: GameObject | null);
|
|
29
|
-
dispatch(event: FrameEvent): void;
|
|
30
28
|
/**
|
|
31
|
-
* This method is called
|
|
32
|
-
* Recommended for GameObject cration.
|
|
29
|
+
* This method is called when the active state changes.
|
|
33
30
|
*/
|
|
34
|
-
protected
|
|
35
|
-
/**
|
|
36
|
-
* This method is called only once.
|
|
37
|
-
*/
|
|
38
|
-
protected start(): void;
|
|
39
|
-
/**
|
|
40
|
-
* This method is called on every frame.
|
|
41
|
-
*/
|
|
42
|
-
protected update(): void;
|
|
43
|
-
/**
|
|
44
|
-
* This method is called before the object is destroyed.
|
|
45
|
-
*/
|
|
46
|
-
protected destroy(): void;
|
|
31
|
+
protected onActiveChange(): void;
|
|
47
32
|
/**
|
|
48
33
|
* @returns The current loaded scene
|
|
49
34
|
*/
|
|
50
35
|
protected getCurrentScene<T extends Scene>(): T;
|
|
51
36
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @param
|
|
54
|
-
* @
|
|
55
|
-
|
|
56
|
-
protected addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
|
|
57
|
-
/**
|
|
58
|
-
* @param name The name of the game object to find
|
|
59
|
-
* @returns The found game object
|
|
60
|
-
*/
|
|
61
|
-
protected findGameObjectByName<T extends GameObject>(name: string): T;
|
|
62
|
-
/**
|
|
63
|
-
* @param tag The tag of the game objects to find
|
|
64
|
-
* @returns The found game objects
|
|
65
|
-
*/
|
|
66
|
-
protected findGameObjectsByTag(tag: string): GameObject[];
|
|
67
|
-
/**
|
|
68
|
-
* @param tag The tag of the game object to find
|
|
69
|
-
* @returns The found game object
|
|
70
|
-
*/
|
|
71
|
-
protected findGameObjectByTag<T extends GameObject>(tag: string): T;
|
|
72
|
-
/**
|
|
73
|
-
* Add a components to the game obejct
|
|
74
|
-
*
|
|
75
|
-
* @param componentFactory The factory function for the component
|
|
76
|
-
* @param name (optional) The name of the component, this must not be used by another component
|
|
37
|
+
* Add a component to the game obejct
|
|
38
|
+
* @param componentClass The class of the component
|
|
39
|
+
* @param options [optional] The options passed to the init method of the component
|
|
40
|
+
* @param name [optional] The name of the component
|
|
77
41
|
* @returns The added component
|
|
78
42
|
*/
|
|
79
|
-
addComponent<
|
|
43
|
+
addComponent<ComponentType extends Component = Component, OptionsType extends InitOptions = InitOptions>(componentClass: ComponentClass<ComponentType>, options?: OptionsType, name?: string): ComponentType;
|
|
80
44
|
private checkMultipleComponent;
|
|
81
45
|
/**
|
|
82
|
-
*
|
|
46
|
+
* Returns all the components in the game object.
|
|
47
|
+
* @returns The found components
|
|
83
48
|
*/
|
|
84
49
|
getComponents(): Component[];
|
|
85
50
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @
|
|
88
|
-
*/
|
|
89
|
-
getComponentByName<T extends Component>(name: string): T;
|
|
90
|
-
/**
|
|
91
|
-
* @param type The type of the component to find
|
|
92
|
-
* @returns The found component
|
|
93
|
-
*/
|
|
94
|
-
getComponentByType<T extends Component>(type: string): T;
|
|
95
|
-
/**
|
|
96
|
-
* @param type The type of the components to find
|
|
51
|
+
* Returns all the components for the given class in the game object.
|
|
52
|
+
* @param componentClass The class of the components
|
|
97
53
|
* @returns The found components
|
|
98
54
|
*/
|
|
99
|
-
|
|
55
|
+
getComponents<T extends Component>(componentClass: ComponentClass<T>): T[];
|
|
100
56
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @
|
|
57
|
+
* Returns the first component found for the given class, or undefined otherwise.
|
|
58
|
+
* @param componentClass The class of the component
|
|
59
|
+
* @returns The found component
|
|
103
60
|
*/
|
|
104
|
-
|
|
61
|
+
getComponent<T extends Component>(componentClass: ComponentClass<T>): T;
|
|
105
62
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @
|
|
63
|
+
* Returns the first component found for the given name, or undefined otherwise.
|
|
64
|
+
* @param name The name of the component
|
|
65
|
+
* @returns The found component
|
|
108
66
|
*/
|
|
109
|
-
|
|
67
|
+
getComponent<T extends Component>(name: string): T;
|
|
110
68
|
/**
|
|
111
|
-
*
|
|
69
|
+
* Returns TRUE if the game object has a component for the given class, or FALSE otherwise
|
|
70
|
+
* @param componentClass The class of the component to find
|
|
71
|
+
* @returns boolean
|
|
112
72
|
*/
|
|
113
|
-
|
|
73
|
+
hasComponent<T extends Component>(componentClass: ComponentClass<T>): boolean;
|
|
114
74
|
/**
|
|
115
|
-
* @param
|
|
75
|
+
* @param name The name of the component to find
|
|
76
|
+
* @returns boolean
|
|
116
77
|
*/
|
|
117
|
-
|
|
78
|
+
hasComponent(name: string): boolean;
|
|
79
|
+
removeComponent(component: Component): void;
|
|
118
80
|
/**
|
|
119
81
|
* Add a child game object.
|
|
120
|
-
*
|
|
121
|
-
* @param
|
|
122
|
-
* @param name The name of the
|
|
82
|
+
* @param gameObjectClass The class of the child game object
|
|
83
|
+
* @param options [optional] This options will be passed to the init method
|
|
84
|
+
* @param name [optional] The name of the game object
|
|
123
85
|
* @returns The added child game object
|
|
124
86
|
*/
|
|
125
|
-
addChild<T extends GameObject>(
|
|
87
|
+
addChild<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, name?: string): T;
|
|
126
88
|
/**
|
|
127
89
|
* @returns The children game objects
|
|
128
90
|
*/
|
|
129
|
-
getChildren():
|
|
91
|
+
getChildren<T extends GameObject>(): T[];
|
|
92
|
+
/**
|
|
93
|
+
* Returns the first child found for the given class, or undefined otherwise.
|
|
94
|
+
* @param gameObjectClass The class of the child game object to find
|
|
95
|
+
* @returns The found child game object
|
|
96
|
+
*/
|
|
97
|
+
getChild<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
|
|
130
98
|
/**
|
|
99
|
+
* Returns the first child found for the given name, or undefined otherwise.
|
|
131
100
|
* @param name The name of the child game object to find
|
|
132
101
|
* @returns The found child game object
|
|
133
102
|
*/
|
|
@@ -136,16 +105,6 @@ export declare class GameObject {
|
|
|
136
105
|
* Destroy all the children game objects
|
|
137
106
|
*/
|
|
138
107
|
destroyChildren(): void;
|
|
139
|
-
|
|
140
|
-
* Destroy one game objects by its name
|
|
141
|
-
* @param name The name of the game object
|
|
142
|
-
*/
|
|
143
|
-
destroyGameObjectByName(name: string): void;
|
|
144
|
-
/**
|
|
145
|
-
* Destroy the game objects
|
|
146
|
-
* @param gameObject The game object to destory
|
|
147
|
-
*/
|
|
148
|
-
destroyGameObject(gameObject: GameObject): void;
|
|
149
|
-
private _destroy;
|
|
108
|
+
protected _destroy(): void;
|
|
150
109
|
private destroyComponents;
|
|
151
110
|
}
|
package/lib/core/Scene.d.ts
CHANGED
|
@@ -1,69 +1,10 @@
|
|
|
1
1
|
import { GameCamera } from "../gameObject/GameCamera";
|
|
2
2
|
import { Game } from "./Game";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private readonly gameObjectManager;
|
|
9
|
-
game: Game;
|
|
10
|
-
name: string;
|
|
11
|
-
private started;
|
|
12
|
-
constructor();
|
|
3
|
+
import { GameActor } from "./GameActor";
|
|
4
|
+
export declare class Scene extends GameActor {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly game: Game;
|
|
7
|
+
constructor(name: string, game: Game);
|
|
13
8
|
get gameCamera(): GameCamera;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This method is called only once.
|
|
17
|
-
* Recommended for GameObject cration.
|
|
18
|
-
*/
|
|
19
|
-
protected init(): void;
|
|
20
|
-
/**
|
|
21
|
-
* This method is called only once.
|
|
22
|
-
*/
|
|
23
|
-
protected start(): void;
|
|
24
|
-
/**
|
|
25
|
-
* This method is called on every frame.
|
|
26
|
-
*/
|
|
27
|
-
protected update(): void;
|
|
28
|
-
/**
|
|
29
|
-
* This method is called before the scene is destroyed.
|
|
30
|
-
*/
|
|
31
|
-
protected destroy(): void;
|
|
32
|
-
/**
|
|
33
|
-
* @param gameObjectFactory The factory function for the game object
|
|
34
|
-
* @param name The name of the game object, this must not be used by another game object
|
|
35
|
-
* @returns The added game object
|
|
36
|
-
*/
|
|
37
|
-
protected addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
|
|
38
|
-
/**
|
|
39
|
-
* @returns The all the loaded game objects
|
|
40
|
-
*/
|
|
41
|
-
protected getGameObjects(): GameObject[];
|
|
42
|
-
/**
|
|
43
|
-
* @param name The name of the game object to find
|
|
44
|
-
* @returns The found game object
|
|
45
|
-
*/
|
|
46
|
-
protected findGameObjectByName<T extends GameObject>(name: string): T;
|
|
47
|
-
/**
|
|
48
|
-
* @param tag The tag of the game objects to find
|
|
49
|
-
* @returns The found game objects
|
|
50
|
-
*/
|
|
51
|
-
protected findGameObjectsByTag(tag: string): GameObject[];
|
|
52
|
-
/**
|
|
53
|
-
* @param tag The tag of the game object to find
|
|
54
|
-
* @returns The found game object
|
|
55
|
-
*/
|
|
56
|
-
protected findGameObjectByTag<T extends GameObject>(tag: string): T;
|
|
57
|
-
/**
|
|
58
|
-
* Destroy one game objects by its name
|
|
59
|
-
* @param name The name of the game object
|
|
60
|
-
*/
|
|
61
|
-
protected destroyGameObjectByName(name: string): void;
|
|
62
|
-
/**
|
|
63
|
-
* Destroy the game objects
|
|
64
|
-
*
|
|
65
|
-
* @param gameObject The game object to destory
|
|
66
|
-
*/
|
|
67
|
-
protected destroyGameObject(gameObject: GameObject): void;
|
|
68
|
-
private _destroy;
|
|
9
|
+
protected _destroy(): void;
|
|
69
10
|
}
|
|
@@ -1,54 +1,64 @@
|
|
|
1
|
-
import { GameObjectManager
|
|
2
|
-
import { GameObject } from "../GameObject";
|
|
1
|
+
import { GameObjectManager } from "../managers/GameObjectManager";
|
|
2
|
+
import { GameObject, GameObjectClass } from "../GameObject";
|
|
3
|
+
import { InitOptions } from "../GameActor";
|
|
3
4
|
export declare class GameObjectManagerFacade {
|
|
4
5
|
private static manager;
|
|
5
6
|
static initialize(manager: GameObjectManager): void;
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
8
|
+
* Adds a new game object to the scene.
|
|
9
|
+
* @param gameObjectClass The class of the game object
|
|
10
|
+
* @param options [optional] This options will be passed to the init method
|
|
11
|
+
* @param parent [optional] The parent game object
|
|
12
|
+
* @param name [optional] The name of the game object
|
|
10
13
|
* @returns the added game object
|
|
11
14
|
*/
|
|
12
|
-
static addGameObject<T extends GameObject>(
|
|
15
|
+
static addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, parent?: GameObject, name?: string): T;
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
17
|
+
* Returns all the game objects in the scene.
|
|
18
|
+
* @returns The found game objects
|
|
19
|
+
*/
|
|
20
|
+
static findGameObjects(): GameObject[];
|
|
21
|
+
/**
|
|
22
|
+
* Returns the first game object found for the given class, or undefined otherwise.
|
|
23
|
+
* @param gameObjectClass The game object class to find
|
|
24
|
+
* @returns The found game object
|
|
15
25
|
*/
|
|
16
|
-
static
|
|
26
|
+
static findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
|
|
17
27
|
/**
|
|
28
|
+
* Returns the first game object found for the given name, or undefined otherwise.
|
|
18
29
|
* @param name The name of the game object to find
|
|
19
30
|
* @returns The found game object
|
|
20
31
|
*/
|
|
21
|
-
static
|
|
32
|
+
static findGameObject<T extends GameObject>(name: string): T;
|
|
22
33
|
/**
|
|
34
|
+
* Returns a collection of game objects found for the given parent
|
|
23
35
|
* @param parent The parent game object
|
|
24
36
|
* @returns The found game objects
|
|
25
37
|
*/
|
|
26
|
-
static findGameObjectsByParent(parent: GameObject):
|
|
38
|
+
static findGameObjectsByParent<T extends GameObject>(parent: GameObject): T[];
|
|
27
39
|
/**
|
|
28
|
-
*
|
|
40
|
+
* Returns the first child found for the given parent and class, or undefined otherwise.
|
|
29
41
|
* @param parent The parent game object
|
|
30
|
-
* @param
|
|
31
|
-
* @returns The found game
|
|
42
|
+
* @param gameObjectClass The class of the child game object to find
|
|
43
|
+
* @returns The found child game object
|
|
32
44
|
*/
|
|
33
|
-
static
|
|
45
|
+
static findGameObjectByParent<T extends GameObject>(parent: GameObject, gameObjectClass: GameObjectClass<T>): T;
|
|
34
46
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
47
|
+
* Returns the first child found for the given parent and name, or undefined otherwise.
|
|
48
|
+
* @param parent The parent game object
|
|
49
|
+
* @param name The name of the child game object to find
|
|
50
|
+
* @returns The found child game object
|
|
37
51
|
*/
|
|
38
|
-
static
|
|
52
|
+
static findGameObjectByParent<T extends GameObject>(parent: GameObject, name: string): T;
|
|
39
53
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
54
|
+
* Returns a collection of game objects found for the given tag
|
|
55
|
+
* @param tag The tag of the game objects to find
|
|
56
|
+
* @returns The found game objects
|
|
42
57
|
*/
|
|
43
|
-
static
|
|
58
|
+
static findGameObjectsByTag<T extends GameObject>(tag: string): T[];
|
|
44
59
|
/**
|
|
45
60
|
* Destroy the game objects
|
|
46
61
|
* @param gameObject The game object to destory
|
|
47
62
|
*/
|
|
48
63
|
static destroyGameObject(gameObject: GameObject): void;
|
|
49
|
-
/**
|
|
50
|
-
* Destroy one game objects by its name
|
|
51
|
-
* @param name The name of the game object
|
|
52
|
-
*/
|
|
53
|
-
static destroyGameObjectByName(name: string): void;
|
|
54
64
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { GameObject } from "../GameObject";
|
|
2
|
-
|
|
1
|
+
import { GameObject, GameObjectClass } from "../GameObject";
|
|
2
|
+
import { InitOptions } from "../GameActor";
|
|
3
3
|
export declare class GameObjectManager {
|
|
4
4
|
private gameObjects;
|
|
5
|
-
addGameObject<T extends GameObject>(
|
|
6
|
-
|
|
7
|
-
findGameObjectById(id: string):
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, parent?: GameObject, name?: string): T;
|
|
6
|
+
findGameObjects(): GameObject[];
|
|
7
|
+
findGameObjectById<T extends GameObject>(id: string): T;
|
|
8
|
+
findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
|
|
9
|
+
findGameObject<T extends GameObject>(name: string): T;
|
|
10
|
+
findGameObjectsByParent<T extends GameObject>(parent: GameObject): T[];
|
|
11
|
+
findGameObjectByParent<T extends GameObject>(parent: GameObject, gameObjectClass: GameObjectClass<T>): T;
|
|
12
|
+
findGameObjectByParent<T extends GameObject>(parent: GameObject, name: string): T;
|
|
13
|
+
findGameObjectsByTag<T extends GameObject>(tag: string): T[];
|
|
13
14
|
destroyAllGameObjects(): void;
|
|
14
15
|
destroyGameObject(gameObject: GameObject): void;
|
|
15
16
|
private destroy;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GameObjectManager } from "./GameObjectManager";
|
|
2
|
+
import { SceneManager } from "./SceneManager";
|
|
3
|
+
import { InputManager } from "../../input/InputManager";
|
|
4
|
+
import { CollisionManager } from "../../physics/collision/CollisionManager";
|
|
5
|
+
import { RigidBodyManager } from "../../physics/rigodBody/RigidBodyManager";
|
|
6
|
+
import { RenderManager } from "../../rendering/RenderManager";
|
|
7
|
+
import { TimeManager } from "./TimeManager";
|
|
8
|
+
export declare enum FrameEvent {
|
|
9
|
+
Init = 0,
|
|
10
|
+
Start = 1,
|
|
11
|
+
Update = 2,
|
|
12
|
+
UpdateEngine = 3,
|
|
13
|
+
UpdateCollider = 4,
|
|
14
|
+
UpdatePhysics = 5,
|
|
15
|
+
UpdateTransform = 6,
|
|
16
|
+
UpdatePreRender = 7,
|
|
17
|
+
UpdateCamera = 8,
|
|
18
|
+
UpdateRender = 9,
|
|
19
|
+
Destroy = 10
|
|
20
|
+
}
|
|
21
|
+
export declare class IterationManager {
|
|
22
|
+
private readonly timeManager;
|
|
23
|
+
private readonly collisionManager;
|
|
24
|
+
private readonly physicsManager;
|
|
25
|
+
private readonly renderManager;
|
|
26
|
+
private readonly inputManager;
|
|
27
|
+
private readonly gameObjectManager;
|
|
28
|
+
private readonly sceneManager;
|
|
29
|
+
private gameLoopAccumulator;
|
|
30
|
+
private physicsLoopAccumulator;
|
|
31
|
+
private currentScene;
|
|
32
|
+
private gameObjects;
|
|
33
|
+
private components;
|
|
34
|
+
constructor(timeManager: TimeManager, collisionManager: CollisionManager, physicsManager: RigidBodyManager, renderManager: RenderManager, inputManager: InputManager, gameObjectManager: GameObjectManager, sceneManager: SceneManager);
|
|
35
|
+
update(time: number): void;
|
|
36
|
+
private load;
|
|
37
|
+
private mainIteration;
|
|
38
|
+
private physicsIteration;
|
|
39
|
+
private preRenderIteration;
|
|
40
|
+
private renderIteration;
|
|
41
|
+
private dispatchFrameEvent;
|
|
42
|
+
}
|
|
@@ -26,17 +26,22 @@ export declare class IterationManager {
|
|
|
26
26
|
private readonly inputManager;
|
|
27
27
|
private readonly gameObjectManager;
|
|
28
28
|
private readonly sceneManager;
|
|
29
|
+
running: boolean;
|
|
29
30
|
private gameLoopAccumulator;
|
|
30
|
-
private physicsLoopAccumulator;
|
|
31
31
|
private currentScene;
|
|
32
32
|
private gameObjects;
|
|
33
33
|
private components;
|
|
34
34
|
constructor(timeManager: TimeManager, collisionManager: CollisionManager, physicsManager: RigidBodyManager, renderManager: RenderManager, inputManager: InputManager, gameObjectManager: GameObjectManager, sceneManager: SceneManager);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
private
|
|
35
|
+
start(): void;
|
|
36
|
+
pause(): void;
|
|
37
|
+
resume(): void;
|
|
38
|
+
stop(): void;
|
|
39
|
+
private startLoop;
|
|
40
|
+
private requestAnimationLoop;
|
|
41
|
+
private gameLogicIteration;
|
|
40
42
|
private renderIteration;
|
|
43
|
+
private physicsIteration;
|
|
44
|
+
private asyncPhysicsLoop;
|
|
45
|
+
private load;
|
|
41
46
|
private dispatchFrameEvent;
|
|
42
47
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GameObjectManager } from "./GameObjectManager";
|
|
2
|
+
import { SceneManager } from "./SceneManager";
|
|
3
|
+
import { InputManager } from "../../input/InputManager";
|
|
4
|
+
import { CollisionManager } from "../../physics/collision/CollisionManager";
|
|
5
|
+
import { RigidBodyManager } from "../../physics/rigodBody/RigidBodyManager";
|
|
6
|
+
import { RenderManager } from "../../rendering/RenderManager";
|
|
7
|
+
import { TimeManager } from "./TimeManager";
|
|
8
|
+
export declare enum FrameEvent {
|
|
9
|
+
Init = 0,
|
|
10
|
+
Start = 1,
|
|
11
|
+
Update = 2,
|
|
12
|
+
UpdateEngine = 3,
|
|
13
|
+
UpdateCollider = 4,
|
|
14
|
+
UpdatePhysics = 5,
|
|
15
|
+
UpdateTransform = 6,
|
|
16
|
+
UpdatePreRender = 7,
|
|
17
|
+
UpdateCamera = 8,
|
|
18
|
+
UpdateRender = 9,
|
|
19
|
+
Destroy = 10
|
|
20
|
+
}
|
|
21
|
+
export declare class IterationManager {
|
|
22
|
+
private readonly timeManager;
|
|
23
|
+
private readonly collisionManager;
|
|
24
|
+
private readonly physicsManager;
|
|
25
|
+
private readonly renderManager;
|
|
26
|
+
private readonly inputManager;
|
|
27
|
+
private readonly gameObjectManager;
|
|
28
|
+
private readonly sceneManager;
|
|
29
|
+
private gameLoopAccumulator;
|
|
30
|
+
private physicsLoopAccumulator;
|
|
31
|
+
private currentScene;
|
|
32
|
+
private gameObjects;
|
|
33
|
+
private components;
|
|
34
|
+
constructor(timeManager: TimeManager, collisionManager: CollisionManager, physicsManager: RigidBodyManager, renderManager: RenderManager, inputManager: InputManager, gameObjectManager: GameObjectManager, sceneManager: SceneManager);
|
|
35
|
+
update(time: number): void;
|
|
36
|
+
private load;
|
|
37
|
+
private mainIteration;
|
|
38
|
+
private physicsIteration;
|
|
39
|
+
private preRenderIteration;
|
|
40
|
+
private renderIteration;
|
|
41
|
+
private dispatchFrameEvent;
|
|
42
|
+
}
|