Adds missing data
This commit is contained in:
parent
e6391d9fdd
commit
53cdcc3433
620 changed files with 47293 additions and 151 deletions
|
|
@ -8,7 +8,7 @@ const DISTANCE_TO_PLAYER: float = 10.0
|
|||
@export var character: Enemy
|
||||
|
||||
@export_category("Sprite")
|
||||
@export var sprite:Sprite3D;
|
||||
@export var visual: GeometryInstance3D;
|
||||
@export var idleTexture: Texture2D;
|
||||
@export var aggressiveTexture: Texture2D;
|
||||
|
||||
|
|
@ -25,12 +25,23 @@ var aggressive = false
|
|||
func _physics_process(_delta: float) -> void:
|
||||
self.blackboard.set_var('PlayerDistance', character.global_position.distance_to(Player.Instance.global_position))
|
||||
self.blackboard.set_var('LookingAngleToPlayer', (-character.global_basis.z).dot((character.global_position - Player.Instance.global_position).normalized()))
|
||||
|
||||
self.blackboard.set_var('PlayerVisible', getPlayerVisible())
|
||||
|
||||
func getPlayerVisible() -> bool:
|
||||
var query = PhysicsRayQueryParameters3D.create(Origin.global_position, Player.Instance.global_position);
|
||||
var result = character.get_world_3d().direct_space_state.intersect_ray(query)
|
||||
|
||||
if !result:
|
||||
return false
|
||||
|
||||
return result.collider is Player
|
||||
|
||||
func setAggressive(value: bool) -> void:
|
||||
if not aggressive && value:
|
||||
agent.target_position = character.global_position;
|
||||
|
||||
sprite.texture = aggressiveTexture if value else idleTexture
|
||||
(visual.material_overlay as StandardMaterial3D).albedo_texture = aggressiveTexture if value else idleTexture
|
||||
aggressive = value
|
||||
|
||||
|
||||
|
|
@ -44,7 +55,7 @@ func moveToPlayer() -> void:
|
|||
|
||||
func Fire() -> void:
|
||||
self.animationTree['parameters/playback'].travel('Fire')
|
||||
var instance = MuzzleFlash.instantiate(PackedScene.GEN_EDIT_STATE_INSTANCE)
|
||||
var instance = MuzzleFlash.instantiate()
|
||||
Origin.add_child(instance)
|
||||
character.fireWeapon()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue