// 人物行走
runWalkAction:function(startPos,endPos,mapTileSize){
// 若果角色的属性为不行走,则返回假
if(this.isWalk === false){
return false;
}
// 更改角色当前的行走点ID
this.walkID += 1;
// 根据行走距离更新角色身上的buff
this.updateBuffByDistance();
// 获得行走方向
var turnCharactor = cc.callFunc(this.trunDirection, this, this.getDirection(startPos,endPos));
var moveAction = this.getWalkMoveAction(startPos,endPos,mapTileSize);
var callback = cc.callFunc(function(){
// 向游戏控制组件发送行走结束事件
this.node.dispatchEvent(new cc.Event.EventCustom('walkReturn', true));
}, this);
var action = cc.sequence(turnCharactor,moveAction,callback);
this.node.runAction(action);
},
// 更新行走速度
updateWalkSpeed: function(){
var actionManager = new cc.ActionManager();
// 如果有停止速度的buff 则设置行走状态为假
if(this.distanceSpeedEffect == 'stop' || this.timeSpeedEffect =='stop'){
actionManager.pauseTarget ( this.node );
return;
}
actionManager.resumeTarget ( this.node );
this.walkSpeed = this.walkBaseSpeed + this.timeSpeedEffect + this.distanceSpeedEffect;
// 若距离速度影响使速度小于等于最小速度,则调用最小速度
if(this.walkSpeed < this.minWalkSpeed){
this.walkSpeed = this.minWalkSpeed;
}
}
↧
Creator 的暂停动作问题
↧