import { _decorator, Component, ImageAsset, Node, Sprite, SpriteFrame, Texture2D } from 'cc';
const { ccclass, property } = _decorator;

export class Tools {

    /**
     * 
     * @param node 
     * @param co 
     */
    static clearFromParent(node: Node, co: any) {
        let arr = [];
        node.children.forEach(element => {
            if (element.getComponent(co)) {
                arr.push(element);
            }
        });
        arr.forEach((element) => {
            element.removeFromParent();
        });

    }


    /**
     * 
     * @param min 
     * @param max 
     * @returns 
     */
    public static random_between(min: number, max: number): number {
        return Math.random() * (max - min) + min;
    }
}

