const Phaser = require('phaser');

class ZoneNode extends Phaser.GameObjects.Sprite {
    constructor(scene, x, y, id, success, tag) {
        super(scene, x, y);
        this.setTexture('eye');
        this.scene = scene;
        this.success = success;
        // this.text = (text.indexOf(',') > -1) ? text.split(',') : text;
        this.id = id;
        this.setPosition(x, y);

        const nodeNoDigits = tag.replace(/[0-9]/g, '');
        switch (nodeNoDigits) {
            case 'BOSS':
                this.setScale(0.25);
                break;
            case 'MINIBOSS':
                this.setScale(0.1);
                break;
            default:
                this.setScale(0.05);
        }
        if (this.success) {
            this.setTint(0xff0000);
        }
        this.text = tag;
    }
}

module.exports = ZoneNode;
