Remote weapon firing
parent
65fed80abc
commit
7de4dfb580
|
@ -118,13 +118,13 @@ func _input(event) -> void:
|
|||
rpc_unreliable(&'aim', event)
|
||||
|
||||
if Input.is_action_just_pressed("trigger_primary"):
|
||||
weapon.trigger(0, true)
|
||||
weapon.rpc(&'trigger', 0, true)
|
||||
elif Input.is_action_just_released("trigger_primary"):
|
||||
weapon.trigger(0, false)
|
||||
weapon.rpc(&'trigger', 0, false)
|
||||
if Input.is_action_just_pressed("trigger_secondary"):
|
||||
weapon.trigger(1, true)
|
||||
weapon.rpc(&'trigger', 1, true)
|
||||
elif Input.is_action_just_released("trigger_secondary"):
|
||||
weapon.trigger(1, false)
|
||||
weapon.rpc(&'trigger', 1, false)
|
||||
|
||||
func _physics_process(delta):
|
||||
rpc_unreliable(&'set_global_transform', global_transform)
|
||||
|
|
|
@ -23,7 +23,7 @@ compress/bptc_ldr=0
|
|||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
compress/streamed=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
|
@ -31,6 +31,6 @@ process/fix_alpha_border=true
|
|||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/size_limit=0
|
||||
process/size_limit=256
|
||||
detect_3d/compress_to=0
|
||||
svg/scale=1.0
|
||||
|
|
|
@ -6,11 +6,11 @@ extends Node3D
|
|||
|
||||
#enum Trigger {TRIGGER_PRIMARY, TRIGGER_SECONDARY}
|
||||
|
||||
func trigger(index: int, active: bool) -> void:
|
||||
@remotesync func trigger(index: int, active: bool) -> void:
|
||||
print("Weapon " + str(name) + ", Trigger " + str(index) + ", active: " + str(active))
|
||||
|
||||
if index == 0 and active:
|
||||
$Flash/Particles.emmiting = true
|
||||
$Flash/Particles.emitting = true
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
|
|
@ -1,30 +1,51 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/Weapons/Handgun/Handgun.gltf" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Assets/Weapons/Weapon.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Assets/Weapons/VFX/Flash.png" type="Texture2D" id=3]
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=1]
|
||||
particle_flag_align_y = true
|
||||
[sub_resource type="Gradient" id=1]
|
||||
offsets = PackedFloat32Array( 0, 0.105072, 0.485507, 1 )
|
||||
colors = PackedColorArray( 1, 1, 1, 1, 1, 0.935276, 0.740205, 1, 1, 0.841919, 0.421875, 1, 0, 0, 0, 1 )
|
||||
|
||||
[sub_resource type="GradientTexture" id=2]
|
||||
gradient = SubResource( 1 )
|
||||
|
||||
[sub_resource type="Curve" id=3]
|
||||
_data = [ Vector2( 0, 0 ), 0.0, 14.3675, 0, 0, Vector2( 0.214047, 0.990909 ), -0.869818, -0.869818, 0, 0, Vector2( 1, 0 ), -0.290291, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CurveTexture" id=4]
|
||||
curve = SubResource( 3 )
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=5]
|
||||
lifetime_randomness = 0.01
|
||||
direction = Vector3( -1, 0, 0 )
|
||||
spread = 15.0
|
||||
gravity = Vector3( 0, -9.3, 0 )
|
||||
initial_velocity = 5.0
|
||||
gravity = Vector3( 0, 0, 0 )
|
||||
initial_velocity = 7.0
|
||||
initial_velocity_random = 0.5
|
||||
damping = 4.0
|
||||
angle = 360.0
|
||||
angle_random = 1.0
|
||||
scale_curve = SubResource( 4 )
|
||||
color_ramp = SubResource( 2 )
|
||||
anim_offset = 1.0
|
||||
anim_offset_random = 1.0
|
||||
attractor_interaction_enabled = false
|
||||
|
||||
[sub_resource type="Curve" id=4]
|
||||
_data = [ Vector2( 0, 0.0090909 ), 0.0, 37.0519, 0, 0, Vector2( 0.0820189, 1 ), -1.14279, -1.14279, 0, 0, Vector2( 1, 0 ), 0.110839, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id=2]
|
||||
[sub_resource type="StandardMaterial3D" id=6]
|
||||
blend_mode = 1
|
||||
shading_mode = 0
|
||||
albedo_color = Color( 1, 0.796078, 0.137255, 1 )
|
||||
vertex_color_use_as_albedo = true
|
||||
albedo_texture = ExtResource( 3 )
|
||||
billboard_mode = 3
|
||||
particles_anim_h_frames = 2
|
||||
particles_anim_v_frames = 2
|
||||
particles_anim_loop = false
|
||||
|
||||
[sub_resource type="RibbonTrailMesh" id=3]
|
||||
material = SubResource( 2 )
|
||||
shape = 0
|
||||
size = 0.02
|
||||
sections = 3
|
||||
curve = SubResource( 4 )
|
||||
[sub_resource type="QuadMesh" id=7]
|
||||
material = SubResource( 6 )
|
||||
size = Vector2( 0.5, 0.5 )
|
||||
|
||||
[node name="Weapon" type="Node3D"]
|
||||
script = ExtResource( 2 )
|
||||
|
@ -40,12 +61,12 @@ script = null
|
|||
[node name="Particles" type="GPUParticles3D" parent="Flash"]
|
||||
transform = Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.340809, 0.124171, 0 )
|
||||
emitting = false
|
||||
amount = 16
|
||||
lifetime = 0.1
|
||||
amount = 12
|
||||
lifetime = 0.2
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
process_material = SubResource( 1 )
|
||||
draw_pass_1 = SubResource( 3 )
|
||||
process_material = SubResource( 5 )
|
||||
draw_pass_1 = SubResource( 7 )
|
||||
script = null
|
||||
|
||||
[editable path="Handgun"]
|
||||
|
|
Reference in New Issue