Starsector API
Loading...
Searching...
No Matches
GBGoAwayFrom.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 GBGoAwayFrom extends BaseGhostBehavior {
10
11 protected SectorEntityToken from;
12 protected int maxBurn;
13
14 public GBGoAwayFrom(float duration, SectorEntityToken from, int maxBurn) {
15 super(duration);
16 this.from = from;
17 this.maxBurn = maxBurn;
18 }
19
20
21
22 @Override
23 public void advance(float amount, SensorGhost ghost) {
24 if (from.getContainingLocation() != ghost.getEntity().getContainingLocation() || !from.isAlive()) {
25 end();
26 return;
27 }
28 super.advance(amount, ghost);
29
30 Vector2f loc = Misc.getUnitVectorAtDegreeAngle(Misc.getAngleInDegrees(from.getLocation(), ghost.getEntity().getLocation()));
31 loc.scale(10000f);
32 Vector2f.add(loc, ghost.getEntity().getLocation(), loc);
33 ghost.moveTo(loc, maxBurn);
34
35 }
36
37
38
39}
40
41
42
43
44
45
46
47
48
49
50
51
52
void advance(float amount, SensorGhost ghost)
GBGoAwayFrom(float duration, SectorEntityToken from, int maxBurn)
void moveTo(Vector2f dest, float maxBurn)