/*
RSK World – Tower Defense 3D (Wall)
For support, licensing, or custom development inquiries: help@rskworld.in • Phone/WhatsApp: +91 9330539277
Website: RSK World • Business Inquiries: help@rskworld.in
🤝 Contributing: Suggestions and improvements are welcome!
*/

import * as THREE from 'three';

export class Wall {
	constructor(position) {
		this.position = position.clone();
		this.level = 1;
		this.maxHp = 100;
		this.hp = this.maxHp;
		this.group = this._createMesh();
		this.group.position.copy(this.position);
		this.radius = 1.2;
	}

	_createMesh() {
		const g = new THREE.Group();
		const geo = new THREE.BoxGeometry(2.4, 1.2, 0.6);
		const mat = new THREE.MeshStandardMaterial({ color: 0x64748b, roughness: 0.9, metalness: 0.05 });
		const m = new THREE.Mesh(geo, mat);
		m.castShadow = true;
		m.receiveShadow = true;
		m.position.y = 0.6 / 2;
		g.add(m);

		const capGeo = new THREE.BoxGeometry(2.5, 0.15, 0.7);
		const capMat = new THREE.MeshStandardMaterial({ color: 0x94a3b8, roughness: 0.6 });
		const cap = new THREE.Mesh(capGeo, capMat);
		cap.position.y = 0.66 + 0.075;
		g.add(cap);
		return g;
	}

	addTo(scene) { scene.add(this.group); }
	removeFrom(scene) { scene.remove(this.group); }
}
