MCPcopy
hub / github.com/4ian/GDevelop / SpineRuntimeObject

Class SpineRuntimeObject

Extensions/Spine/spineruntimeobject.ts:39–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 * @category Objects > Spine
38 */
39 export class SpineRuntimeObject
40 extends gdjs.RuntimeObject
41 implements
42 gdjs.Resizable,
43 gdjs.Scalable,
44 gdjs.Animatable,
45 gdjs.OpacityHandler
46 {
47 private _opacity: float = 255;
48 private _scaleX: number = 1;
49 private _scaleY: number = 1;
50 _originalScale: number;
51 private _flippedX: boolean = false;
52 private _flippedY: boolean = false;
53 private _animations: SpineAnimation[];
54 private _currentAnimationIndex = -1;
55 private _animationSpeedScale: float = 1;
56 private _animationPaused: boolean = false;
57 private _isPausedFrameDirty = false;
58 /** The duration in second for the smooth transition between 2 animations */
59 private _animationMixingDuration: number;
60 private _renderer: gdjs.SpineRuntimeObjectPixiRenderer;
61
62 readonly spineResourceName: string;
63
64 static isHitBoxesUpdateDisabled = false;
65
66 /**
67 * @param instanceContainer The container the object belongs to.
68 * @param objectData The object data used to initialize the object
69 */
70 constructor(
71 instanceContainer: gdjs.RuntimeInstanceContainer,
72 objectData: SpineObjectData,
73 instanceData?: InstanceData
74 ) {
75 super(instanceContainer, objectData, instanceData);
76
77 this._animations = objectData.content.animations;
78 this._originalScale = objectData.content.scale;
79 this.spineResourceName = objectData.content.spineResourceName;
80 this._animationMixingDuration = 0;
81 this._renderer = new gdjs.SpineRuntimeObjectRenderer(
82 this,
83 instanceContainer
84 );
85
86 // Apply default skin if specified in the configuration.
87 const skinName = objectData.content.skinName;
88 if (skinName) {
89 this._renderer.setSkin(skinName);
90 }
91
92 this.setAnimationIndex(0);
93 this._renderer.updateAnimation(0);
94
95 if (SpineRuntimeObject.isHitBoxesUpdateDisabled) {
96 this.hitBoxes.length = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected