com.ng.gdxutils.ai.formation.DistanceSlotCostProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gdx-utils Show documentation
Show all versions of gdx-utils Show documentation
A java library that used over libGdx game framework.
The newest version!
package com.ng.gdxutils.ai.formation;
import com.badlogic.gdx.ai.fma.FormationMember;
import com.badlogic.gdx.ai.fma.SoftRoleSlotAssignmentStrategy.SlotCostProvider;
import com.badlogic.gdx.math.Vector2;
/**
* (c) Abhishek Aryan
*
* @author Abhishek Aryan
* @since 28-07-2016
*/
public class DistanceSlotCostProvider implements SlotCostProvider {
@Override
public float getCost(FormationMember member, int slotNumber) {
/*UnitComponent unitComp = (UnitComponent) member;
SquadComponent squadComp = Components.SQUAD.get(unitComp.getSquad());
Vector2 targetPosition = squadComp.enemyPower.getSlotAssignmentAt(slotNumber).member.getTargetLocation().getPosition();
*/
// The cost is the square distance between current position and target position
//return unitComp.getBody().getPosition().dst2(targetPosition);
return .1f;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy