public float getCharacterPositionCost(GeneticCharacter c) { if (this.mapModel != null) { return(this.mapModel.getCharacterPositionCost(c)); } else { return(float.MaxValue); } }
/* * CHARACTERS */ public void characterMove(GeneticCharacter c, float newX, float newY) { int new_x = Mathf.RoundToInt(newX); int new_y = Mathf.RoundToInt(newY); // Check if the new Position is a valid Tile if (this.isUsefulPosition(new_x, new_y)) { int old_x = Mathf.RoundToInt(c.getPosX()); int old_y = Mathf.RoundToInt(c.getPosY()); int oldIndex = this.graphIndexFromTile(old_x, old_y); int newIndex = this.graphIndexFromTile(new_x, new_y); // Check if there is a edge between the new Position and the old one if (this.graph.isAdjacent(oldIndex, newIndex) != null) { c.setPos(new Vector2(new_x, new_y)); } } }
public float getCharacterPositionCost(GeneticCharacter c) { return(this.mapTiles[getCharacterPositionY(c)][getCharacterPositionX(c)].VertexCost); }
private bool checkCharacterPosition(GeneticCharacter c) { return(this.isUsefulPosition(getCharacterPositionX(c), getCharacterPositionY(c))); }
public int getCharacterGraphPosition(GeneticCharacter c) { return(this.graphIndexFromTile(getCharacterPositionX(c), getCharacterPositionY(c))); }
public int getCharacterPositionY(GeneticCharacter c) { return(Mathf.RoundToInt(c.getPosY())); }