美文网首页
2d对象池

2d对象池

作者: 沉麟 | 来源:发表于2020-07-09 16:36 被阅读0次
    getCoinPool() {
            if (this.coinPools.length <= 0) {
                let coin = new Laya.Image();
                coin.skin = "res/game/icon_jinbi.png";
                return coin;
            } else {
                return this.coinPools.pop();
            }
        }
    
        pushCoinPool(coin: Laya.Image) {
            this.coinPools.push(coin);
        }
    
        getLinePool() {
            if (this.linePools.length <= 0) {
                let coinAni = this.coinLineAni.clone();
                return coinAni;
            } else {
                return this.linePools.pop();
            }
        }
    
        pushLinePool(coinAni: Laya.Animation) {
            this.linePools.push(coinAni);
        }
    

    相关文章

      网友评论

          本文标题:2d对象池

          本文链接:https://www.haomeiwen.com/subject/tcescktx.html