diff --git a/animator-runtime/animator2.x/core/AnimatorBase.ts b/animator-runtime/animator2.x/core/AnimatorBase.ts index d589ea3..3681277 100644 --- a/animator-runtime/animator2.x/core/AnimatorBase.ts +++ b/animator-runtime/animator2.x/core/AnimatorBase.ts @@ -121,6 +121,8 @@ export default class AnimatorBase extends cc.Component { */ protected initJson(json: any) { this._ac = new AnimatorController(this, json); + // 执行默认状态 + this._ac.changeState(json.defaultState); } /** diff --git a/animator-runtime/animator2.x/core/AnimatorController.ts b/animator-runtime/animator2.x/core/AnimatorController.ts index 4b48e56..3f98840 100644 --- a/animator-runtime/animator2.x/core/AnimatorController.ts +++ b/animator-runtime/animator2.x/core/AnimatorController.ts @@ -41,13 +41,11 @@ export default class AnimatorController { return; } - let defaultState: string = json.defaultState; this._anyState = new AnimatorState(json.anyState, this); for (let i = 0; i < json.states.length; i++) { let state: AnimatorState = new AnimatorState(json.states[i], this); this._states.set(state.name, state); } - this.changeState(defaultState); } private updateState() { diff --git a/animator-runtime/animator3.x/core/AnimatorBase.ts b/animator-runtime/animator3.x/core/AnimatorBase.ts index 9892628..2f539a0 100644 --- a/animator-runtime/animator3.x/core/AnimatorBase.ts +++ b/animator-runtime/animator3.x/core/AnimatorBase.ts @@ -122,6 +122,8 @@ export default class AnimatorBase extends Component { */ protected initJson(json: any) { this._ac = new AnimatorController(this, json); + // 执行默认状态 + this._ac.changeState(json.defaultState); } /** diff --git a/animator-runtime/animator3.x/core/AnimatorController.ts b/animator-runtime/animator3.x/core/AnimatorController.ts index 263da52..3a541e0 100644 --- a/animator-runtime/animator3.x/core/AnimatorController.ts +++ b/animator-runtime/animator3.x/core/AnimatorController.ts @@ -42,13 +42,11 @@ export default class AnimatorController { return; } - let defaultState: string = json.defaultState; this._anyState = new AnimatorState(json.anyState, this); for (let i = 0; i < json.states.length; i++) { let state: AnimatorState = new AnimatorState(json.states[i], this); this._states.set(state.name, state); } - this.changeState(defaultState); } private updateState() { diff --git a/examples/example2-2-2/assets/script/animator/core/AnimatorBase.ts b/examples/example2-2-2/assets/script/animator/core/AnimatorBase.ts index d589ea3..3681277 100644 --- a/examples/example2-2-2/assets/script/animator/core/AnimatorBase.ts +++ b/examples/example2-2-2/assets/script/animator/core/AnimatorBase.ts @@ -121,6 +121,8 @@ export default class AnimatorBase extends cc.Component { */ protected initJson(json: any) { this._ac = new AnimatorController(this, json); + // 执行默认状态 + this._ac.changeState(json.defaultState); } /** diff --git a/examples/example2-2-2/assets/script/animator/core/AnimatorController.ts b/examples/example2-2-2/assets/script/animator/core/AnimatorController.ts index 4b48e56..3f98840 100644 --- a/examples/example2-2-2/assets/script/animator/core/AnimatorController.ts +++ b/examples/example2-2-2/assets/script/animator/core/AnimatorController.ts @@ -41,13 +41,11 @@ export default class AnimatorController { return; } - let defaultState: string = json.defaultState; this._anyState = new AnimatorState(json.anyState, this); for (let i = 0; i < json.states.length; i++) { let state: AnimatorState = new AnimatorState(json.states[i], this); this._states.set(state.name, state); } - this.changeState(defaultState); } private updateState() { diff --git a/examples/example3-0rc/assets/script/animator/core/AnimatorBase.ts b/examples/example3-0rc/assets/script/animator/core/AnimatorBase.ts index 9892628..2f539a0 100644 --- a/examples/example3-0rc/assets/script/animator/core/AnimatorBase.ts +++ b/examples/example3-0rc/assets/script/animator/core/AnimatorBase.ts @@ -122,6 +122,8 @@ export default class AnimatorBase extends Component { */ protected initJson(json: any) { this._ac = new AnimatorController(this, json); + // 执行默认状态 + this._ac.changeState(json.defaultState); } /** diff --git a/examples/example3-0rc/assets/script/animator/core/AnimatorController.ts b/examples/example3-0rc/assets/script/animator/core/AnimatorController.ts index 263da52..3a541e0 100644 --- a/examples/example3-0rc/assets/script/animator/core/AnimatorController.ts +++ b/examples/example3-0rc/assets/script/animator/core/AnimatorController.ts @@ -42,13 +42,11 @@ export default class AnimatorController { return; } - let defaultState: string = json.defaultState; this._anyState = new AnimatorState(json.anyState, this); for (let i = 0; i < json.states.length; i++) { let state: AnimatorState = new AnimatorState(json.states[i], this); this._states.set(state.name, state); } - this.changeState(defaultState); } private updateState() {