import { Player } from './Player.js'; export class Team { constructor(scene, color, numberOfPlayers, isPlayerTeam) { this.scene = scene; this.color = color; this.numberOfPlayers = numberOfPlayers; this.isPlayerTeam = isPlayerTeam; this.players = []; this.createTeam(); } createTeam() { for (let i = 0; i < this.numberOfPlayers; i++) { const position = this.generatePosition(i); const player = new Player(this.scene, this.color, position, this.isPlayerTeam ? 'player' : 'bot', this); this.players.push(player); } } resetPositions() { this.players.forEach(player => { player.mesh.position.copy(player.mesh.initialPosition); player.velocity.set(0, 0, 0); }); } generatePosition(i) { if (this.isPlayerTeam) { if (i === 0) { return { x: -15, y: 1.5, z: 0 }; } else { return { x: -Math.random() * 25 - 5, // Left side y: 1.5, z: (Math.random() - 0.5) * 80 }; } } else { return { x: Math.random() * 25 + 5, // Right side y: 1.5, z: (Math.random() - 0.5) * 80 }; } } }