玻璃破碎实训--(待完善)

This commit is contained in:
joylink_zhaoerwei 2024-05-08 16:15:27 +08:00
parent 438a232431
commit f3f2f1d5a2
7 changed files with 78 additions and 7 deletions

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://k0e2shfdjyrq"
path="res://.godot/imported/glass-breaking.mp3-48587bf4763194802507d785eef82d16.mp3str"
[deps]
source_file="res://Assets/music/glass-breaking.mp3"
dest_files=["res://.godot/imported/glass-breaking.mp3-48587bf4763194802507d785eef82d16.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -83,6 +83,9 @@ enum ScreenDoor_Fault_State{
##设置故障
func setScreenDoorFault (faultType:ScreenDoor_Fault_State)-> void:
screenDoorFaultState = faultType
if faultType == ScreenDoor_Fault_State.glassBreakage :
$leftDoor_broken.visible = true
$leftDoor_broken/AudioStreamPlayer.play()
##恢复故障
func removeScreenDoorFault ()-> void:

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=44 format=3 uid="uid://bc2dnsyx16kk6"]
[gd_scene load_steps=45 format=3 uid="uid://bc2dnsyx16kk6"]
[ext_resource type="Script" path="res://sceen/platform/screenDoor.gd" id="1_nse1y"]
[ext_resource type="Texture2D" uid="uid://57t8x7rlqk7y" path="res://Model/textures/GD_SDFSDF_an.jpg" id="2_rf1ed"]
@ -10,6 +10,7 @@
[ext_resource type="Texture2D" uid="uid://bam8omg8k1bhe" path="res://Model/textures/2cengtietu_zst111.png" id="7_flsdv"]
[ext_resource type="Texture2D" uid="uid://eogu2aigjbda" path="res://Model/textures/Gd_ZTM.jpg" id="8_aqfjl"]
[ext_resource type="Texture2D" uid="uid://co0ggcy26r38g" path="res://Model/textures/2cengtietu_zst.png" id="9_da8bg"]
[ext_resource type="AudioStream" uid="uid://k0e2shfdjyrq" path="res://Assets/music/glass-breaking.mp3" id="9_kpf37"]
[sub_resource type="Shader" id="Shader_qbwwy"]
code = "// NOTE: Shader automatically converted from Godot Engine 4.2.2.stable's StandardMaterial3D.
@ -559,6 +560,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.5433, 0.870711, 2.58114)
mesh = SubResource("ArrayMesh_idblo")
skeleton = NodePath("")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="leftDoor_broken"]
stream = ExtResource("9_kpf37")
[node name="left_tape" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.00068, 2.06215, 1.62728)
visible = false

View File

@ -35,16 +35,20 @@ enum ScreenDoor_name{
##设置指定屏蔽门开门故障
func setAssignScreenDoorsOpenFault (screenDoorNames:Array)-> void:
for child in $platform.screenDoorALL:
var screenDoorName=String(child.name)
var screenDoorIndex=int(screenDoorName[screenDoorName.length() - 1])
if screenDoorIndex in screenDoorNames:
child.setScreenDoorFault(ScreenDoor.ScreenDoor_Fault_State.openFault)
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.openFault)
##设置指定屏蔽门关门故障
func setAssignScreenDoorsCloseFault (screenDoorNames:Array)-> void:
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.closeFault)
##设置指定屏蔽门玻璃破碎故障
func setAssignScreenDoorsGlassBreakageFault (screenDoorNames:Array)-> void:
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.glassBreakage)
func setAssignScreenDoorsFault (screenDoorNames:Array,faultType:ScreenDoor.ScreenDoor_Fault_State)-> void:
for child in $platform.screenDoorALL:
var screenDoorName=String(child.name)
var screenDoorIndex=int(screenDoorName[screenDoorName.length() - 1])
if screenDoorIndex in screenDoorNames:
child.setScreenDoorFault(ScreenDoor.ScreenDoor_Fault_State.closeFault)
child.setScreenDoorFault(faultType)

View File

@ -0,0 +1,18 @@
extends Node
## 实训名称
@export var trainingName: String = "实训"
## 场景描述
@export var trainingDesc: String = "场景描述"
func _ready():
$TrainingDescDialog.title = trainingName
$TrainingDescDialog.updateSceneDesc(trainingDesc)
func _on_training_desc_dialog_start_training():
$Timer.start()
func _on_timer_timeout() -> void:
$total.setAssignScreenDoorsGlassBreakageFault([TotalScene.ScreenDoor_name.screenDoor2])

View File

@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://2p2vu21jtbtp"]
[ext_resource type="Script" path="res://trainings/trainingGlassBreakageFault/trainingGlassBreakageFault.gd" id="1_gyskf"]
[ext_resource type="PackedScene" uid="uid://qh8b3g6n3k2u" path="res://trainings/training_desc_dialog.tscn" id="2_qfrwf"]
[ext_resource type="PackedScene" uid="uid://btcksdsburk7t" path="res://sceen/total.tscn" id="3_28hir"]
[node name="trainingGlassBreakageFault" type="Node"]
script = ExtResource("1_gyskf")
trainingName = "全自动运行线路站台门滑动门玻璃破碎应急处置"
trainingDesc = "全自动运行线路站台门滑动门玻璃破碎应急处置"
[node name="TrainingDescDialog" parent="." instance=ExtResource("2_qfrwf")]
size = Vector2i(400, 300)
[node name="total" parent="." instance=ExtResource("3_28hir")]
[node name="Timer" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
[connection signal="StartTraining" from="TrainingDescDialog" to="." method="_on_training_desc_dialog_start_training"]
[connection signal="close_requested" from="TrainingDescDialog" to="TrainingDescDialog" method="_on_close_requested"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]