1,
var Rotate = pc.createScript(‘rotate‘); Rotate.attributes.add(‘speed‘,{ type: ‘number‘, default: 2 }); Rotate.prototype.initialize = function(){ this.on(‘enable‘, function(){ console.log(‘Enabled‘); }); this.on(‘disable‘, function(){ console.log(‘Disable‘); }); }; Rotate.prototype.update = function(dt){ this.entity.rotateLocal(0, this.speed * dt, 0); };
原文:https://www.cnblogs.com/eliteboy/p/14888835.html