Starsector API
Loading...
Searching...
No Matches
GBITowardsDirection.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.ghosts;
2
3import com.fs.starfarer.api.campaign.SectorEntityToken;
4import com.fs.starfarer.api.util.Misc;
5
7
8 protected float facing;
9 protected SectorEntityToken from;
10
11 public GBITowardsDirection(float delay, SectorEntityToken from, float facing) {
12 super(delay);
13 this.from = from;
14 this.facing = facing;
15 }
16
17 @Override
18 public boolean shouldInterruptBehavior(SensorGhost ghost, GhostBehavior behavior) {
19 if (hasDelayRemaining()) return false;
20
21 float grace = 15f;
22 float angle = Misc.getAngleInDegrees(from.getLocation(), ghost.getEntity().getLocation());
23
24 return Misc.getAngleDiff(angle, facing) < grace;
25 }
26
27
28}
GBITowardsDirection(float delay, SectorEntityToken from, float facing)
boolean shouldInterruptBehavior(SensorGhost ghost, GhostBehavior behavior)