generated from krampus/template-godot4
This commit is contained in:
parent
7fa75c3cf0
commit
1ab14b6bb1
BIN
asset_dev/sfx/spray.aup3
Normal file
BIN
asset_dev/sfx/spray.aup3
Normal file
Binary file not shown.
BIN
asset_dev/sfx/spray.aup3-shm
Normal file
BIN
asset_dev/sfx/spray.aup3-shm
Normal file
Binary file not shown.
BIN
asset_dev/sfx/spray.aup3-wal
Normal file
BIN
asset_dev/sfx/spray.aup3-wal
Normal file
Binary file not shown.
BIN
assets/sfx/tools/spray.wav
Normal file
BIN
assets/sfx/tools/spray.wav
Normal file
Binary file not shown.
24
assets/sfx/tools/spray.wav.import
Normal file
24
assets/sfx/tools/spray.wav.import
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://b5ik76jgl8mex"
|
||||||
|
path="res://.godot/imported/spray.wav-7cfa0acfe728bc004ce67c19ceb0c018.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sfx/tools/spray.wav"
|
||||||
|
dest_files=["res://.godot/imported/spray.wav-7cfa0acfe728bc004ce67c19ceb0c018.sample"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
force/8_bit=false
|
||||||
|
force/mono=false
|
||||||
|
force/max_rate=false
|
||||||
|
force/max_rate_hz=44100
|
||||||
|
edit/trim=false
|
||||||
|
edit/normalize=false
|
||||||
|
edit/loop_mode=2
|
||||||
|
edit/loop_begin=0
|
||||||
|
edit/loop_end=-1
|
||||||
|
compress/mode=2
|
18
src/equipment/beam_sfx/spray_sfx.gd
Normal file
18
src/equipment/beam_sfx/spray_sfx.gd
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
class_name SpraySFX extends AudioStreamPlayer3D
|
||||||
|
## Plays only as long as `activate` is called every frame.
|
||||||
|
|
||||||
|
var _active_this_frame := false
|
||||||
|
|
||||||
|
|
||||||
|
func activate() -> void:
|
||||||
|
_active_this_frame = true
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
if _active_this_frame:
|
||||||
|
if not playing:
|
||||||
|
play()
|
||||||
|
else:
|
||||||
|
stop()
|
||||||
|
|
||||||
|
_active_this_frame = false
|
1
src/equipment/beam_sfx/spray_sfx.gd.uid
Normal file
1
src/equipment/beam_sfx/spray_sfx.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bhvkgqpm7sglw
|
12
src/equipment/beam_sfx/spray_sfx.tscn
Normal file
12
src/equipment/beam_sfx/spray_sfx.tscn
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://btq11kil0jcql"]
|
||||||
|
|
||||||
|
[ext_resource type="AudioStream" uid="uid://b5ik76jgl8mex" path="res://assets/sfx/tools/spray.wav" id="1_575yt"]
|
||||||
|
[ext_resource type="Script" uid="uid://bhvkgqpm7sglw" path="res://src/equipment/beam_sfx/spray_sfx.gd" id="2_yajv7"]
|
||||||
|
|
||||||
|
[node name="SpraySFX" type="AudioStreamPlayer3D"]
|
||||||
|
stream = ExtResource("1_575yt")
|
||||||
|
attenuation_model = 1
|
||||||
|
volume_db = -2.0
|
||||||
|
unit_size = 1.0
|
||||||
|
bus = &"SFX"
|
||||||
|
script = ExtResource("2_yajv7")
|
@ -12,11 +12,12 @@ const NORMAL_OFFSET = 0.05
|
|||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
if is_colliding() and parent_tool.firing:
|
if is_colliding() and parent_tool.firing:
|
||||||
var child_pos := get_collision_point() + get_collision_normal() * NORMAL_OFFSET
|
var child_pos := get_collision_point() + get_collision_normal() * NORMAL_OFFSET
|
||||||
|
for c: Node in get_children():
|
||||||
|
if c is Node3D:
|
||||||
|
(c as Node3D).global_position = child_pos
|
||||||
|
|
||||||
laser_dust.global_position = child_pos
|
|
||||||
laser_dust.emitting = true
|
laser_dust.emitting = true
|
||||||
|
|
||||||
glow_light.global_position = child_pos
|
|
||||||
glow_light.visible = true # TODO: tween maybe?
|
glow_light.visible = true # TODO: tween maybe?
|
||||||
else:
|
else:
|
||||||
laser_dust.emitting = false
|
laser_dust.emitting = false
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
class_name PointSpray extends Spray
|
class_name PointSpray extends Spray
|
||||||
## Simple single-point spraygun
|
## Simple single-point spraygun
|
||||||
|
|
||||||
|
|
||||||
@export var spray_scale := 1.5
|
@export var spray_scale := 1.5
|
||||||
@export var damage := 0.3334
|
@export var damage := 0.3334
|
||||||
|
|
||||||
@onready var laser: LaserCast = %LaserCast
|
@onready var laser: LaserCast = %LaserCast
|
||||||
|
@onready var spray_sfx: SpraySFX = %SpraySFX
|
||||||
|
|
||||||
|
|
||||||
func _spray() -> void:
|
func _spray() -> void:
|
||||||
if laser.is_colliding():
|
if laser.is_colliding():
|
||||||
|
spray_sfx.activate()
|
||||||
|
|
||||||
var collider := laser.get_collider()
|
var collider := laser.get_collider()
|
||||||
if collider is GunkBody:
|
if collider is GunkBody:
|
||||||
var point := laser.get_collision_point()
|
var point := laser.get_collision_point()
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=15 format=3 uid="uid://cc102xko0u6yj"]
|
[gd_scene load_steps=16 format=3 uid="uid://cc102xko0u6yj"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dngia2ldbccv7" path="res://src/equipment/point_spray/point_spray.gd" id="1_2yl2v"]
|
[ext_resource type="Script" uid="uid://dngia2ldbccv7" path="res://src/equipment/point_spray/point_spray.gd" id="1_2yl2v"]
|
||||||
[ext_resource type="Material" uid="uid://c00gndxoepuqh" path="res://assets/materials/laser_spray.tres" id="2_0pfy3"]
|
[ext_resource type="Material" uid="uid://c00gndxoepuqh" path="res://assets/materials/laser_spray.tres" id="2_0pfy3"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bn0gcsy37ahto" path="res://assets/ui/hud/reticle_large.png" id="2_qcl8j"]
|
[ext_resource type="Texture2D" uid="uid://bn0gcsy37ahto" path="res://assets/ui/hud/reticle_large.png" id="2_qcl8j"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://btq11kil0jcql" path="res://src/equipment/beam_sfx/spray_sfx.tscn" id="3_5h54c"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b8vradbaw61ga" path="res://src/equipment/laser_cast/laser_cast.tscn" id="3_qmoff"]
|
[ext_resource type="PackedScene" uid="uid://b8vradbaw61ga" path="res://src/equipment/laser_cast/laser_cast.tscn" id="3_qmoff"]
|
||||||
[ext_resource type="Script" uid="uid://b274q7uvn0cvp" path="res://src/ui/rumbler_3d.gd" id="5_k4cg5"]
|
[ext_resource type="Script" uid="uid://b274q7uvn0cvp" path="res://src/ui/rumbler_3d.gd" id="5_k4cg5"]
|
||||||
[ext_resource type="PackedScene" uid="uid://5y7gcq6igjpf" path="res://src/equipment/beam_sfx/beam_sfx.tscn" id="5_tpavj"]
|
[ext_resource type="PackedScene" uid="uid://5y7gcq6igjpf" path="res://src/equipment/beam_sfx/beam_sfx.tscn" id="5_tpavj"]
|
||||||
@ -63,6 +64,10 @@ unique_name_in_owner = true
|
|||||||
target_position = Vector3(0, 0, -3)
|
target_position = Vector3(0, 0, -3)
|
||||||
parent_tool = NodePath("../..")
|
parent_tool = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="SpraySFX" parent="Muzzle/LaserCast" instance=ExtResource("3_5h54c")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
attenuation_model = 0
|
||||||
|
|
||||||
[node name="SprayEffect" type="MeshInstance3D" parent="Muzzle"]
|
[node name="SprayEffect" type="MeshInstance3D" parent="Muzzle"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
transform = Transform3D(1, 0, 0, 0, -4.47035e-08, -1, 0, 1, -4.47035e-08, 0, 0, -1.6)
|
transform = Transform3D(1, 0, 0, 0, -4.47035e-08, -1, 0, 1, -4.47035e-08, 0, 0, -1.6)
|
||||||
|
@ -12,6 +12,7 @@ var _busy := false
|
|||||||
|
|
||||||
@onready var spray_casts: Node3D = %SprayCasts
|
@onready var spray_casts: Node3D = %SprayCasts
|
||||||
@onready var animation_player: AnimationPlayer = %AnimationPlayer
|
@onready var animation_player: AnimationPlayer = %AnimationPlayer
|
||||||
|
@onready var spray_sfx: SpraySFX = %SpraySFX
|
||||||
|
|
||||||
|
|
||||||
func switch_mode() -> void:
|
func switch_mode() -> void:
|
||||||
@ -41,6 +42,8 @@ func _spray() -> void:
|
|||||||
|
|
||||||
for laser: LaserCast in spray_casts.get_children():
|
for laser: LaserCast in spray_casts.get_children():
|
||||||
if laser.is_colliding():
|
if laser.is_colliding():
|
||||||
|
spray_sfx.activate()
|
||||||
|
|
||||||
var collider := laser.get_collider()
|
var collider := laser.get_collider()
|
||||||
if collider is GunkBody:
|
if collider is GunkBody:
|
||||||
var target := collider as GunkBody
|
var target := collider as GunkBody
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=21 format=3 uid="uid://d2hnxr5l6w2x4"]
|
[gd_scene load_steps=22 format=3 uid="uid://d2hnxr5l6w2x4"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dv40fyim2g2fa" path="res://src/equipment/wide_spray/wide_spray.gd" id="1_ggkto"]
|
[ext_resource type="Script" uid="uid://dv40fyim2g2fa" path="res://src/equipment/wide_spray/wide_spray.gd" id="1_ggkto"]
|
||||||
[ext_resource type="Material" uid="uid://c00gndxoepuqh" path="res://assets/materials/laser_spray.tres" id="2_26efp"]
|
[ext_resource type="Material" uid="uid://c00gndxoepuqh" path="res://assets/materials/laser_spray.tres" id="2_26efp"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cx28sj02y31kj" path="res://assets/ui/hud/reticle_crosshair.png" id="3_78jy6"]
|
[ext_resource type="Texture2D" uid="uid://cx28sj02y31kj" path="res://assets/ui/hud/reticle_crosshair.png" id="3_78jy6"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://btq11kil0jcql" path="res://src/equipment/beam_sfx/spray_sfx.tscn" id="3_v0jnx"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b8vradbaw61ga" path="res://src/equipment/laser_cast/laser_cast.tscn" id="3_xahet"]
|
[ext_resource type="PackedScene" uid="uid://b8vradbaw61ga" path="res://src/equipment/laser_cast/laser_cast.tscn" id="3_xahet"]
|
||||||
[ext_resource type="Texture2D" uid="uid://carrggw6kp14w" path="res://assets/ui/hud/reticle_left.png" id="4_rotxf"]
|
[ext_resource type="Texture2D" uid="uid://carrggw6kp14w" path="res://assets/ui/hud/reticle_left.png" id="4_rotxf"]
|
||||||
[ext_resource type="Texture2D" uid="uid://wp03nuwt8hp5" path="res://assets/ui/hud/reticle_right.png" id="5_xo3vu"]
|
[ext_resource type="Texture2D" uid="uid://wp03nuwt8hp5" path="res://assets/ui/hud/reticle_right.png" id="5_xo3vu"]
|
||||||
@ -190,6 +191,10 @@ parent_tool = NodePath("../../../..")
|
|||||||
[node name="LaserCast4" parent="Muzzle/Pivot/SprayCasts" node_paths=PackedStringArray("parent_tool") instance=ExtResource("3_xahet")]
|
[node name="LaserCast4" parent="Muzzle/Pivot/SprayCasts" node_paths=PackedStringArray("parent_tool") instance=ExtResource("3_xahet")]
|
||||||
parent_tool = NodePath("../../../..")
|
parent_tool = NodePath("../../../..")
|
||||||
|
|
||||||
|
[node name="SpraySFX" parent="Muzzle/Pivot/SprayCasts/LaserCast4" instance=ExtResource("3_v0jnx")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
attenuation_model = 0
|
||||||
|
|
||||||
[node name="LaserCast5" parent="Muzzle/Pivot/SprayCasts" node_paths=PackedStringArray("parent_tool") instance=ExtResource("3_xahet")]
|
[node name="LaserCast5" parent="Muzzle/Pivot/SprayCasts" node_paths=PackedStringArray("parent_tool") instance=ExtResource("3_xahet")]
|
||||||
target_position = Vector3(0.167, 0, -2)
|
target_position = Vector3(0.167, 0, -2)
|
||||||
parent_tool = NodePath("../../../..")
|
parent_tool = NodePath("../../../..")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user