22 lines
627 B
GDScript
22 lines
627 B
GDScript
extends Node3D
|
|
|
|
var minions = []
|
|
var minion_nav_point = []
|
|
var number_minions : int
|
|
var rot_amount : float
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
minions = self.get_children()
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
for i in minions:
|
|
number_minions = minions.size()
|
|
rot_amount = 360 / number_minions
|
|
i.nav_agent.set_target_position(i.player.global_transform.origin)
|
|
var next_nav_point = i.nav_agent.get_next_path_position()
|
|
|
|
i.hive_velocity = (next_nav_point - i.global_transform.origin).normalized() * i.SPEED
|