Starsector API
Loading...
Searching...
No Matches
GBGoTo.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.ghosts;
2
3import org.lwjgl.util.vector.Vector2f;
4
5import com.fs.starfarer.api.campaign.SectorEntityToken;
6import com.fs.starfarer.api.util.Misc;
7
8
9public class GBGoTo extends BaseGhostBehavior {
10
11 protected SectorEntityToken to;
12 protected int maxBurn;
13
14 public GBGoTo(float duration, SectorEntityToken to, int maxBurn) {
15 super(duration);
16 this.to = to;
17 this.maxBurn = maxBurn;
18 }
19
20
21
22 @Override
23 public void advance(float amount, SensorGhost ghost) {
24 super.advance(amount, ghost);
25
26 ghost.moveTo(to.getLocation(), new Vector2f(), maxBurn);
27
28 float dist = Misc.getDistance(ghost.getEntity(), to);
29 if (dist < ghost.getEntity().getRadius() + to.getRadius()) {
30 end();
31 return;
32 }
33
34 }
35
36
37
38}
39
40
41
42
43
44
45
46
47
48
49
50
51
void advance(float amount, SensorGhost ghost)
Definition GBGoTo.java:23
GBGoTo(float duration, SectorEntityToken to, int maxBurn)
Definition GBGoTo.java:14
void moveTo(Vector2f dest, float maxBurn)