AI has better detection, committing before a larger rework
This commit is contained in:
@@ -2,12 +2,14 @@ extends EnemyState
|
||||
class_name EnemyStunned
|
||||
|
||||
@export var stunned_stars : Node
|
||||
@export var stun_time_start : float = 5.0
|
||||
|
||||
var move_direction : Vector3
|
||||
var scan_direction : float
|
||||
|
||||
var wander_time : float
|
||||
var scan_time : float
|
||||
var stun_time
|
||||
|
||||
const WANDER_AMT = 50
|
||||
const TURRET_TURN_AMT : float = 180.0
|
||||
@@ -18,6 +20,7 @@ func Enter():
|
||||
if stunned_stars:
|
||||
stunned_stars.visible = true
|
||||
randomize_wander()
|
||||
stun_time = stun_time_start
|
||||
|
||||
func _Exit():
|
||||
if stunned_stars:
|
||||
@@ -28,6 +31,12 @@ func Update(delta):
|
||||
wander_time -= delta
|
||||
else:
|
||||
randomize_wander()
|
||||
|
||||
if stun_time > 0:
|
||||
stun_time -= delta
|
||||
else:
|
||||
stunned_stars.visible = false
|
||||
Transitioned.emit(self,"idle")
|
||||
|
||||
func Physics_Update(delta : float):
|
||||
if enemy:
|
||||
@@ -36,7 +45,7 @@ func Physics_Update(delta : float):
|
||||
var direction = local_destination.normalized()
|
||||
if enemy.global_position.distance_to(local_destination) > 1:
|
||||
enemy.velocity = direction * move_speed
|
||||
enemy.global_rotation.y += delta
|
||||
enemy.global_rotation.y += delta * 4
|
||||
|
||||
func randomize_wander():
|
||||
var x = randf_range(-WANDER_AMT,WANDER_AMT)
|
||||
|
||||
Reference in New Issue
Block a user