почин диалогов, пратиклы от выстлеров
This commit is contained in:
@@ -265,13 +265,37 @@ func displayMuzzleFlash():
|
||||
push_error("%s doesn't have a muzzle flash reference" % cW.weaponName)
|
||||
return
|
||||
|
||||
# НАЙДИ И ПОЛНОСТЬСТЬЮ ЗАМЕНИ ЭТУ ФУНКЦИЮ В WeaponManagerScript.gd:
|
||||
|
||||
# Сначала загружаем файл искр в самом верху скрипта (к остальным preload, если есть, или прямо перед функцией):
|
||||
const SPARKS_SCENE = preload("res://addons/Weapons/bullet_sparks.tscn.tscn") # Укажи правильный путь к файлу из Шага 1!
|
||||
|
||||
func displayBulletHole(colliderPoint : Vector3, colliderNormal : Vector3):
|
||||
#create a muzzle flash instance, and display it at the indicated point
|
||||
var bulletDecalInstance = bulletDecal.instantiate()
|
||||
get_tree().get_root().add_child(bulletDecalInstance)
|
||||
bulletDecalInstance.global_position = colliderPoint
|
||||
bulletDecalInstance.look_at(colliderPoint - colliderNormal, Vector3.UP)
|
||||
bulletDecalInstance.rotate_object_local(Vector3(1.0, 0.0, 0.0), 90)
|
||||
# 1. Оригинальный код автора для спавна декали дырки от пули
|
||||
if bulletDecal != null:
|
||||
var bulletDecalInstance = bulletDecal.instantiate()
|
||||
get_tree().get_root().add_child(bulletDecalInstance)
|
||||
bulletDecalInstance.global_position = colliderPoint
|
||||
bulletDecalInstance.look_at(colliderPoint - colliderNormal, Vector3.UP)
|
||||
bulletDecalInstance.rotate_object_local(Vector3(1.0, 0.0, 0.0), 90)
|
||||
|
||||
# 2. НАШЕ НОВОЕ ДОБАВЛЕНИЕ: СПАВН ПАРТИКЛОВ ИСКР
|
||||
if SPARKS_SCENE != null:
|
||||
# Было: var sparks_instance = SPARKS_SCENE.instAPE()
|
||||
# НАДО (СТРОГО ВОТ ТАК):
|
||||
var sparks_instance = SPARKS_SCENE.instantiate()
|
||||
|
||||
get_tree().get_root().add_child(sparks_instance)
|
||||
|
||||
# Слегка смещаем искры назад от стены (на 0.05 метра вдоль нормали),
|
||||
# чтобы они гарантированно не рендерились внутри текстуры стены!
|
||||
sparks_instance.global_position = colliderPoint + (colliderNormal * 0.05)
|
||||
|
||||
if colliderNormal.length() > 0.01:
|
||||
sparks_instance.look_at(sparks_instance.global_position + colliderNormal, Vector3.UP)
|
||||
|
||||
|
||||
|
||||
|
||||
func weaponSoundManagement(soundName : AudioStream, soundSpeed : float):
|
||||
var audioIns : AudioStreamPlayer3D = audioManager.instantiate()
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
extends GPUParticles3D
|
||||
|
||||
func _ready() -> void:
|
||||
# 1. ЖЕСТКО ВЫСТАВЛЯЕМ ПРАВИЛЬНЫЙ МАСШТАБ СЦЕНЫ
|
||||
# Если узел импортировался с нулевым размером, этот код принудительно вернет ему 3D-объем!
|
||||
global_scale(Vector3(1.0, 1.0, 1.0))
|
||||
|
||||
# 2. ПРИНУДИТЕЛЬНО ВКЛЮЧАЕМ ИЗЛУЧЕНИЕ ЧАСТИЦ
|
||||
one_shot = true
|
||||
emitting = true
|
||||
|
||||
print("[ПАРТИКЛЫ] Вспышка искр аппаратно запущена в точке: ", global_position)
|
||||
|
||||
# Ждем время жизни частиц и полностью удаляем из памяти
|
||||
await get_tree().create_timer(lifetime + 0.3).timeout
|
||||
queue_free()
|
||||
@@ -0,0 +1 @@
|
||||
uid://cc6y3jlx8drh5
|
||||
@@ -0,0 +1,42 @@
|
||||
[gd_scene format=3 uid="uid://cjwcwlnfcannh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cc6y3jlx8drh5" path="res://addons/Weapons/bullet_sparks.gd" id="1_u7xtr"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_u7xtr"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_cpqpf"]
|
||||
curve = SubResource("Curve_u7xtr")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_cpqpf"]
|
||||
direction = Vector3(1, 0, 1)
|
||||
spread = 67.909
|
||||
initial_velocity_min = 5.0
|
||||
initial_velocity_max = 10.0
|
||||
gravity = Vector3(0, -10, 0)
|
||||
scale_curve = SubResource("CurveTexture_cpqpf")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_u7xtr"]
|
||||
transparency = 1
|
||||
albedo_color = Color(1, 0.9647059, 0.1764706, 1)
|
||||
emission_enabled = true
|
||||
emission = Color(0.8980392, 0.6392157, 0, 1)
|
||||
emission_energy_multiplier = 5.14
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_cpqpf"]
|
||||
material = SubResource("StandardMaterial3D_u7xtr")
|
||||
size = Vector3(0.025, 0.025, 0.015)
|
||||
|
||||
[node name="BulletSparks" type="Node3D" unique_id=395763942]
|
||||
|
||||
[node name="GPUParticles3D" type="GPUParticles3D" parent="." unique_id=340434318]
|
||||
emitting = false
|
||||
amount = 30
|
||||
lifetime = 0.11
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
randomness = 1.0
|
||||
process_material = SubResource("ParticleProcessMaterial_cpqpf")
|
||||
draw_pass_1 = SubResource("BoxMesh_cpqpf")
|
||||
script = ExtResource("1_u7xtr")
|
||||
Reference in New Issue
Block a user