more ai work
This commit is contained in:
@@ -10,6 +10,7 @@ extends RigidBody3D
|
||||
@onready var radius_shape: CollisionShape3D = $BlastRadius/CollisionShape3D
|
||||
@onready var audio_drop: AudioStreamPlayer3D = $audio_drop
|
||||
@onready var flames: GPUParticles3D = $Flames
|
||||
@onready var collision_check: RayCast3D = $CollisionCheck
|
||||
|
||||
var leak_hp = false
|
||||
var blast_amount
|
||||
@@ -56,7 +57,6 @@ func explode():
|
||||
#apply linear velocity power as the inverse % of distance towards the edge (bonus points if using curve texture)
|
||||
#break breakable objects
|
||||
for body in bodies_in_blast:
|
||||
|
||||
#calculate blast power and direction
|
||||
var blast_direction = (body.global_position - blast_radius_area.global_position).normalized()
|
||||
var blast_amount = 1 - ((body.global_position - blast_radius_area.global_position).length() / radius_shape.shape.radius)
|
||||
@@ -82,6 +82,8 @@ func explode():
|
||||
body.stunned_timer.start()
|
||||
body.velocity += blast_velocity
|
||||
|
||||
SignalBus.emit_signal("suspicious_sound",global_position,180,35)
|
||||
|
||||
#Spawn gpu particles
|
||||
var explosionspawn = explosion.instantiate()
|
||||
explosionspawn.position = self.global_position
|
||||
|
||||
@@ -335,6 +335,7 @@ func _physics_process(delta):
|
||||
var recoil_amount = Vector3(-.3,0,0)
|
||||
land_sound.volume_db = land_volume
|
||||
land_sound.play()
|
||||
SignalBus.emit_signal("suspicious_sound",global_position,10,10)
|
||||
Input.start_joy_vibration(0,.1,.1,.1)
|
||||
recoil.add_recoil(recoil_amount,10,10)
|
||||
moving_fast_top_speed = 0.0
|
||||
@@ -555,6 +556,10 @@ func _headbob(time) -> Vector3:
|
||||
|
||||
if pos.y >= .07 and is_on_floor() and velocity.length() >= 1 and !footstep_sound.is_playing():
|
||||
footstep_sound.play()
|
||||
if !crouched:
|
||||
SignalBus.emit_signal("suspicious_sound",global_position,10,7)
|
||||
else:
|
||||
SignalBus.emit_signal("suspicious_sound",global_position,5,1)
|
||||
|
||||
return pos
|
||||
|
||||
|
||||
@@ -101,8 +101,11 @@ func _ready():
|
||||
func _process(delta):
|
||||
line_of_sight.global_position = global_position
|
||||
move_and_slide()
|
||||
look_at_player()
|
||||
|
||||
if !is_on_floor():
|
||||
velocity -= Vector3(0,9.8,0) * delta
|
||||
|
||||
look_at_player()
|
||||
|
||||
func stun():
|
||||
change_state_to("stunned")
|
||||
|
||||
@@ -21,7 +21,7 @@ class_name weapon_resource
|
||||
@export var bullet_force_mod = 5.0
|
||||
@export var bullet_speed = 600
|
||||
@export var decibels_of_gunfire_sound = 160.0
|
||||
@export var max_distance_heard = 100 #in meters
|
||||
@export var max_distance_heard = 75 #in meters
|
||||
@export_group("Gun Assets")
|
||||
@export var casing : Resource
|
||||
@export var mag : Resource
|
||||
|
||||
Reference in New Issue
Block a user