public CPlayer(byte player_index, PLAYER_TYPE player_type, SendFn send_function, CLocalServer local_server) { this.player_index = player_index; this.agent = new CPlayerAgent(player_index); this.player_type = player_type; switch (this.player_type) { case PLAYER_TYPE.HUMAN: this.send_function = send_function; break; case PLAYER_TYPE.AI: this.ai_logic = new CAIPlayer(local_server); this.send_function = this.ai_logic.send; break; } }