добавил сигареты как бонус + анимации моделе врагов

This commit is contained in:
2026-07-24 01:57:55 +07:00
parent 0d03c06854
commit af01cf14e7
58 changed files with 178009 additions and 291 deletions
+790 -282
View File
File diff suppressed because one or more lines are too long
+23
View File
@@ -1,4 +1,5 @@
extends CharacterBody3D
@onready var anim_player = $AnimationPlayer # Убедись, что имя узла в дереве сцены совпадает буква в букву!
@export var move_speed: float = 4.0 # Скорость преследования игрока
@export var damage_to_player: float = 10.0 # Базовый урон за один выстрел
@@ -168,6 +169,28 @@ func _physics_process(delta: float) -> void:
if has_node("/root/MusicManager"):
get_node("/root/MusicManager").unregister_enemy_vision(self, custom_battle_music)
# === ИСПРАВЛЕННЫЙ И НЕУБИВАЕМЫЙ БЛОК АНИМАЦИЙ ДЛЯ UAL ===
if anim_player != null:
# Высчитываем дистанцию до игрока для точного переключения стейтов
var distance_to_p = 999.0
if player_node != null:
distance_to_p = global_position.distance_to(player_node.global_position)
# Моб бежит, если игрок в зоне видимости и расстояние больше дистанции атаки (2.5м)
var is_moving_now = is_player_in_range and distance_to_p > 2.5
if is_moving_now:
# Если анимация бега еще не запущена или плеер полностью остановился
if anim_player.assigned_animation != "Jog_Fwd" or not anim_player.is_playing():
anim_player.play("Jog_Fwd", 0.2) # 0.2 — плавное сглаживание переходов костей
else:
# Если моб стоит на месте (в укрытии, стреляет или потерял игрока)
# Проверяем, чтобы покой не сбивал анимацию удара/выстрела Punch_Jab
if anim_player.assigned_animation != "Idle" and anim_player.assigned_animation != "Punch_Jab":
if not anim_player.is_playing() or anim_player.assigned_animation == "Jog_Fwd":
anim_player.play("Idle", 0.2)
# =======================================================
move_and_slide()
func has_clear_line_of_sight() -> bool: