Skip to content

关于动作Motion调用 #4

Description

@Weidows

let po = this.model.toModelPosition(new PIXI.Point(offsetX, offsetY)),
hitAreas;
if (Object.keys(this.model.internalModel.hitAreas).length == 0) {
hitAreas = this.hitTest(po.x, po.y);
if (hitAreas.includes("TouchHead")) {
this.model.internalModel.motionManager.startMotion(
"",
motionIndex[0]
);
} else if (hitAreas.includes("TouchSpecial")) {
this.model.internalModel.motionManager.startMotion(
"",
motionIndex[1]
);
} else if (hitAreas.includes("TouchBody")) {
this.model.internalModel.motionManager.startMotion(
"",
motionIndex[2]
);
} else {
this.model.internalModel.motionManager.startRandomMotion("");
}
} else {
hitAreas = this.model.internalModel.hitTest(po.x, po.y);
if (hitAreas.includes("head") || hitAreas.includes("Head")) {
this.model.expression();
this.model.motion("Tap");
} else if (hitAreas.includes("body") || hitAreas.includes("Body")) {
this.model.motion("tap_body");
this.model.motion("Tap");
} else this.model.motion("Tap");
}
console.log("Start motion: ", hitAreas.join(" / "));

这块的逻辑虽然并不乱, 但是不是很优雅灵活

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions