summaryrefslogtreecommitdiffhomepage
path: root/app/systems/ai/target_player.rb
blob: 1e4a3eae88fff492731f7ba4b59e559e3dca0004 (plain)
1
2
3
4
5
6
7
8
9
10
11
FF::Sys.new("TargetPlayer", priority: 40) do
  FF::Cmp::SingletonRandomAIPick[0].entities.each do |entity|
    sep = entity.components[FF::Cmp::BoidsSeparation][0]
    sep.distance = 200
    follow_mgr = entity.components[FF::Cmp::Follow]
    player_boid = FF::Cmp::SingletonPlayer[0].entities[0].components[FF::Cmp::Boid][0]
    if follow_mgr.nil? || follow_mgr.empty?
      entity.add FF::Cmp::Follow.new(target: player_boid, strength: 1.2)
    end
  end
end