Autopan to last sector

This commit is contained in:
Anuken
2020-07-29 23:36:59 -04:00
parent 9bf3074aee
commit 66c0c9baa2
4 changed files with 22 additions and 2 deletions

View File

@@ -84,7 +84,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
public Dialog show(){
mode = look;
selected = hovered = launchSector = null;
launching= false;
launching = false;
if(planets.planet.getLastSector() != null){
lookAt(planets.planet.getLastSector());
}
return super.show();
}
@@ -95,7 +98,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
launching = false;
//update view to sector
planets.camPos.set(Tmp.v33.set(sector.tile.v).rotate(Vec3.Y, -sector.planet.getRotation()));
lookAt(sector);
zoom = 1f;
planets.zoom = 2f;
selectAlpha = 0f;
@@ -107,6 +110,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
super.show();
}
private void lookAt(Sector sector){
planets.camPos.set(Tmp.v33.set(sector.tile.v).rotate(Vec3.Y, -sector.planet.getRotation()));
}
boolean canLaunch(Sector sector){
return mode == launch &&
(sector.tile.v.within(launchSector.tile.v, (launchRange + 0.5f) * planets.planet.sectorApproxRadius*2) //within range