import { _decorator,Component} from 'cc';
import { RenderPriority } from '../data/BattleEnum';
const { ccclass, property } = _decorator;


//战斗基础类
@ccclass('BattleNodeBase')
export class BattleNodeBase extends Component {

    priority: RenderPriority = RenderPriority.Role;
    ID: number = 0;
    typeID: number = 0;

    //是否锁定,锁定后不能做其他操作
    protected _isLock: boolean = false;
    //锁定时间 最多锁3秒
    protected _lockTime: number = 0;

    set isLock(isLock:boolean){
        this._isLock = isLock;
        this._lockTime = isLock?3:0;
    }
    get isLock(){
        return this._isLock;
    }
    // start() {

    // }

    update(deltaTime: number) {
        if(this._lockTime > 0){
            this._lockTime -= deltaTime;
            if(this._lockTime <= 0){
                this._isLock = false;
            }
        }
    }
}