var Carhost = pc.createScript('carhost');
Carhost.attributes.add("rightDoorEntity", { type: "entity", title: "RightDoorEntity" });
// initialize code called once per entity
Carhost.prototype.initialize = function() {
var app = this.app;
app.on('carOpenDoor', this.carOpenDoor, this);
};
// update code called every frame
Carhost.prototype.update = function(dt) {
};
Carhost.prototype.carOpenDoor = function (index) {
console.log(111)
console.log(this.rightDoorEntity.anim.getBoolean('IsOpenrun'))
this.rightDoorEntity.anim.setBoolean('IsOpenrun', !this.rightDoorEntity.anim.getBoolean('IsOpenrun'));
};
The first click of the button can trigger the animation, and the second click has no effect