cc.Class({
    extends: require("BasePlayerController"),

    properties: {
        leftTouchNode:cc.Node,
        rightTouchNode:cc.Node,
        charactor:cc.Node,
    },
    onLoad () {
        //注册回调事件
        let Self = this;
        this.leftTouchNode.on('gesture', function (event) {
            console.log(event.name);
            Self.leftGesture(event.name);
        })

        this.rightTouchNode.on('gesture', function (event) {
            console.log(event.name);
            Self.rightGesture(event.name);
        })
    },
    start () {
        this.init();
    },
    init(){
        //角色脚本
        this.ctorScp = this.charactor.getComponent('BaseCharactor');
    },
    leftGesture(name)
    {
        if(name == 'up')
        {
            this.ctorScp.attack(1);
        }
        else if(name == 'down')
        {
  
        }
        else if(name == 'left')
        {

        }
        else if(name == 'right')
        {
            this.ctorScp.attack(1);
        }
    },
    rightGesture(name)
    {
        if(name == 'up')
        {
            this.ctorScp.attack(0);
        }
        else if(name == 'down')
        {

        }
        else if(name == 'left')
        {
            this.ctorScp.attack(0);
        }
        else if(name == 'right')
        {
 
        }
    },
   
    // update (dt) {},
});
