PlusOneObj.ts 865 Bytes
import { ObjType } from "../BattleConst";
import { MapData } from "./MapData";
import { ObjData } from "./ObjData";

export class PlusOneObj extends ObjData {


    init(map: MapData, type: ObjType, gridX: number, gridY: number): void {
        super.init(map, type, gridX, gridY);
        this._imgName = 'UI_yxz_tsfk_+1q';
    }

    onCollisonToBall(collider: cc.Collider): void {

        super.onCollisonToBall(collider);

        if (!this._droped) {
            this.map.battle.profit.marbles++;
            this.map.battle.addToRoundClear(this);
            this.dropDown();
        }
    }

    clone(): PlusOneObj {
        let ret = new PlusOneObj();
        this.cloneValue(ret);
        return ret;
    }

    // protected cloneValue(target: PlusOneObj): void {
    //     super.cloneValue(target);
    //     target._droped = this._droped;
    // }

}