001package com.fs.starfarer.api.impl.campaign.ghosts;
002
003import org.lwjgl.util.vector.Vector2f;
004
005import com.fs.starfarer.api.campaign.SectorEntityToken;
006import com.fs.starfarer.api.util.Misc;
007
008
009public class GBGoTo extends BaseGhostBehavior {
010        
011        protected SectorEntityToken to;
012        protected int maxBurn;
013        
014        public GBGoTo(float duration, SectorEntityToken to, int maxBurn) {
015                super(duration);
016                this.to = to;
017                this.maxBurn = maxBurn;
018        }
019
020
021
022        @Override
023        public void advance(float amount, SensorGhost ghost) {
024                super.advance(amount, ghost);
025                
026                ghost.moveTo(to.getLocation(), new Vector2f(), maxBurn);
027                
028                float dist = Misc.getDistance(ghost.getEntity(), to);
029                if (dist < ghost.getEntity().getRadius() + to.getRadius()) {
030                        end();
031                        return;
032                }
033                
034        }
035        
036        
037        
038}
039
040
041
042
043
044
045
046
047
048
049
050
051