Starsector API
Loading...
Searching...
No Matches
GBITowardsEntity.java
Go to the documentation of this file.
1
package
com.fs.starfarer.api.impl.campaign.ghosts;
2
3
import
com.fs.starfarer.api.campaign.SectorEntityToken;
4
import
com.fs.starfarer.api.util.Misc;
5
6
public
class
GBITowardsEntity
extends
BaseGhostBehaviorInterrupt
{
7
8
protected
SectorEntityToken
from
;
9
protected
SectorEntityToken
to
;
10
11
public
GBITowardsEntity
(
float
delay
,
SectorEntityToken
from
,
SectorEntityToken
to
) {
12
super(
delay
);
13
this.from =
from
;
14
this.to =
to
;
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
float
facing =
Misc
.
getAngleInDegrees
(
from
.
getLocation
(),
to
.
getLocation
());
24
25
return
Misc
.
getAngleDiff
(angle, facing) < grace;
26
}
27
28
29
}
com.fs.starfarer.api.impl.campaign.ghosts.BaseGhostBehaviorInterrupt
Definition
BaseGhostBehaviorInterrupt.java:5
com.fs.starfarer.api.impl.campaign.ghosts.BaseGhostBehaviorInterrupt.hasDelayRemaining
boolean hasDelayRemaining()
Definition
BaseGhostBehaviorInterrupt.java:21
com.fs.starfarer.api.impl.campaign.ghosts.BaseGhostBehaviorInterrupt.delay
float delay
Definition
BaseGhostBehaviorInterrupt.java:6
com.fs.starfarer.api.impl.campaign.ghosts.GBITowardsEntity
Definition
GBITowardsEntity.java:6
com.fs.starfarer.api.impl.campaign.ghosts.GBITowardsEntity.to
SectorEntityToken to
Definition
GBITowardsEntity.java:9
com.fs.starfarer.api.impl.campaign.ghosts.GBITowardsEntity.shouldInterruptBehavior
boolean shouldInterruptBehavior(SensorGhost ghost, GhostBehavior behavior)
Definition
GBITowardsEntity.java:18
com.fs.starfarer.api.impl.campaign.ghosts.GBITowardsEntity.from
SectorEntityToken from
Definition
GBITowardsEntity.java:8
com.fs.starfarer.api.impl.campaign.ghosts.GBITowardsEntity.GBITowardsEntity
GBITowardsEntity(float delay, SectorEntityToken from, SectorEntityToken to)
Definition
GBITowardsEntity.java:11
com.fs.starfarer.api.util.Misc
Definition
Misc.java:188
com.fs.starfarer.api.util.Misc.getAngleDiff
static float getAngleDiff(float from, float to)
Definition
Misc.java:1716
com.fs.starfarer.api.util.Misc.getAngleInDegrees
static float getAngleInDegrees(Vector2f v)
Definition
Misc.java:1126
com.fs.starfarer.api.campaign.SectorEntityToken
Definition
SectorEntityToken.java:27
com.fs.starfarer.api.campaign.SectorEntityToken.getLocation
Vector2f getLocation()
com.fs.starfarer.api.impl.campaign.ghosts.GhostBehavior
Definition
GhostBehavior.java:3
com.fs.starfarer.api.impl.campaign.ghosts.SensorGhost
Definition
SensorGhost.java:11
com.fs.starfarer.api.impl.campaign.ghosts.SensorGhost.getEntity
CustomCampaignEntityAPI getEntity()
src
com
fs
starfarer
api
impl
campaign
ghosts
GBITowardsEntity.java
Generated by
1.12.0