Parcourir la source

Improve pause demo

Aaron Franke il y a 5 ans
Parent
commit
67a490ab50
3 fichiers modifiés avec 13 ajouts et 23 suppressions
  1. 6 6
      misc/pause/pause_button.gd
  2. 0 10
      misc/pause/spinpause.gd
  3. 7 7
      misc/pause/spinpause.tscn

+ 6 - 6
misc/pause/pause_button.gd

@@ -1,16 +1,16 @@
 extends Button
 
 func _ready():
-	#This ensures that this Node won't be paused, allowing it to
-	#process even when the SceneTree is paused. Without that it would
-	#not be able to unpause the game. Note that you can set this through
-	#the inspector as well
+	# This ensures that this Node won't be paused, allowing it to
+	# process even when the SceneTree is paused. Without that it would
+	# not be able to unpause the game. Note that you can set this through
+	# the inspector as well.
 	pause_mode = Node.PAUSE_MODE_PROCESS
 
 
 func _toggled(button_pressed):
-	#Pause or unpause the SceneTree based on whether the button is
-	#toggled on or off
+	# Pause or unpause the SceneTree based on whether the button is
+	# toggled on or off.
 	get_tree().paused = button_pressed
 	if button_pressed:
 		text = "Unpause"

+ 0 - 10
misc/pause/spinpause.gd

@@ -1,10 +0,0 @@
-extends Spatial
-
-func _on_pause_pressed():
-	get_node("pause_popup").set_exclusive(true)
-	get_node("pause_popup").popup()
-	get_tree().set_pause(true)
-
-func _on_unpause_pressed():
-	get_node("pause_popup").hide()
-	get_tree().set_pause(false)

+ 7 - 7
misc/pause/spinpause.tscn

@@ -8,7 +8,7 @@
 length = 10.0
 loop = true
 tracks/0/type = "value"
-tracks/0/path = NodePath("cube:rotation_degrees")
+tracks/0/path = NodePath("Cube:rotation_degrees")
 tracks/0/interp = 1
 tracks/0/loop_wrap = true
 tracks/0/imported = false
@@ -20,26 +20,26 @@ tracks/0/keys = {
 "values": [ Vector3( 0, 0, 0 ), Vector3( 0, -360, 0 ) ]
 }
 
-[node name="pause_scene" type="Spatial"]
+[node name="PauseScene" type="Spatial"]
 
-[node name="cube" type="MeshInstance" parent="."]
+[node name="Cube" type="MeshInstance" parent="."]
 mesh = SubResource( 1 )
 material/0 = null
 
-[node name="camera" type="Camera" parent="."]
+[node name="Camera" type="Camera" parent="."]
 transform = Transform( 0.571594, 0.275303, -0.772974, 0, 0.942035, 0.335515, 0.820537, -0.191779, 0.538461, -5.59754, 2.75935, 4.01344 )
 fov = 74.0
 near = 0.1
 
-[node name="anim" type="AnimationPlayer" parent="."]
+[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
 autoplay = "spin"
 anims/spin = SubResource( 2 )
 
-[node name="spot" type="SpotLight" parent="."]
+[node name="SpotLight" type="SpotLight" parent="."]
 transform = Transform( 0.792992, 0.251051, -0.555101, 0, 0.911149, 0.412078, 0.609232, -0.326775, 0.722534, -3.05357, 1.80053, 3.64099 )
 spot_range = 6.0
 
-[node name="pause_button" type="Button" parent="."]
+[node name="PauseButton" type="Button" parent="."]
 pause_mode = 2
 anchor_left = 0.5
 anchor_top = 0.5