import BaseEvent from "./base/BaseEvent";

/**
 * 地上的临时道具
 */
const {ccclass, property} = cc._decorator;

@ccclass
export default class FTmpGood extends BaseEvent {

    @property({
        displayName: '临时道具id'
    })
    public goodId = 2001;

    private isCheck = false
    /**
     * 主角进入碰撞区域
     */
    public onBegin(tag:number){
        if(this.isCheck){
            return
        }
        this.isCheck = true
        let header = this.ff.mFFheader;
        header.addTmpGood(this.goodId,1);
        cc.tween(this.node).sequence(
            cc.spawn(
                cc.moveBy(1, cc.v2(0, 60)).easing(cc.easeSineOut()),
                cc.fadeOut(1)
            ),
            cc.callFunc(()=>{
                this.node.removeFromParent(true);
                this.node.destroy();
            })
        ).start();
    }
    /**
     * 主角离开碰撞区域
     */
    public onEnd(tag:number){
    }

}
