43 lines
1.9 KiB
Text
43 lines
1.9 KiB
Text
[gd_scene format=3 uid="uid://2bcdil33vx2s"]
|
|
|
|
[ext_resource type="PackedScene" uid="uid://dok0m7ig74vhk" path="res://assets/models/props/fragments/cop_bot_fragments.blend" id="1_lutgq"]
|
|
[ext_resource type="PackedScene" uid="uid://tdwettjsx1o2" path="res://objects/effects/impact_flash_green_large.tscn" id="2_jkj0s"]
|
|
[ext_resource type="Material" uid="uid://7d4c1oui1np3" path="res://assets/effects/particle_materials/explosion_dithered.tres" id="3_masau"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_lutgq"]
|
|
resource_name = "CopBotDestroyed"
|
|
script/source = "extends Node3D
|
|
|
|
var count : int = 0
|
|
var linear_velocity_force : float = 7
|
|
|
|
func _ready():
|
|
$ImpactFlash2.restart()
|
|
await PlayerCamera.get_instance().impact_effect($ImpactFlash2.process_material.color, 0.1, 0.0, 0.02).timeout
|
|
iter(self)
|
|
|
|
func iter(node):
|
|
for child in node.get_children():
|
|
if child is RigidBody3D:
|
|
var velocity_direction : Vector3 = Vector3(1, 0 ,0).rotated(Vector3.UP, randf_range(0, PI*2)).normalized()
|
|
child.linear_velocity = ((child.global_position - global_position).normalized() + velocity_direction) * linear_velocity_force
|
|
child.angular_velocity = Vector3(randf_range(4, 5), randf_range(4, 5), randf_range(4, 5))
|
|
count += 1
|
|
if count % 3 != 0:
|
|
get_tree().create_timer(5 + (count % 5)).timeout.connect(child.queue_free)
|
|
iter(child)
|
|
"
|
|
|
|
[sub_resource type="QuadMesh" id="QuadMesh_n1tfk"]
|
|
material = ExtResource("3_masau")
|
|
center_offset = Vector3(0, 0, -0.1)
|
|
|
|
[node name="CopBotDestroyed" type="Node3D" unique_id=720212118]
|
|
script = SubResource("GDScript_lutgq")
|
|
|
|
[node name="cop_bot_fragments" parent="." unique_id=1650216329 instance=ExtResource("1_lutgq")]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
|
|
|
|
[node name="ImpactFlash2" parent="." unique_id=297038791 instance=ExtResource("2_jkj0s")]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00251311, 0.280107, 0)
|
|
draw_pass_1 = SubResource("QuadMesh_n1tfk")
|