All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.robocode.tankroyale.botapi.mapper.BotStateMapper Maven / Gradle / Ivy

There is a newer version: 0.28.1
Show newest version
package dev.robocode.tankroyale.botapi.mapper;

import dev.robocode.tankroyale.botapi.BotState;

import static dev.robocode.tankroyale.botapi.Color.fromString;

/**
 * Utility class for mapping a bot state.
 */
public final class BotStateMapper {

    // Hide constructor to prevent instantiation
    private BotStateMapper() {
    }

    public static BotState map(final dev.robocode.tankroyale.schema.game.BotState source) {
        return new BotState(
                source.getIsDroid(),
                source.getEnergy(),
                source.getX(),
                source.getY(),
                source.getDirection(),
                source.getGunDirection(),
                source.getRadarDirection(),
                source.getRadarSweep(),
                source.getSpeed(),
                source.getTurnRate(),
                source.getGunTurnRate(),
                source.getRadarTurnRate(),
                source.getGunHeat(),
                source.getEnemyCount(),
                fromString(source.getBodyColor()),
                fromString(source.getTurretColor()),
                fromString(source.getRadarColor()),
                fromString(source.getBulletColor()),
                fromString(source.getScanColor()),
                fromString(source.getTracksColor()),
                fromString(source.getGunColor())
        );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy