Add recalling and summoning table
This commit is contained in:
		
							parent
							
								
									d0fbc077ec
								
							
						
					
					
						commit
						5331087313
					
				| @ -166,6 +166,11 @@ zoom_orbit_in={ | |||||||
| "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(336, 24),"global_position":Vector2(350, 94),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null) | "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(336, 24),"global_position":Vector2(350, 94),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null) | ||||||
| ] | ] | ||||||
| } | } | ||||||
|  | toggle_table={ | ||||||
|  | "deadzone": 0.5, | ||||||
|  | "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) | ||||||
|  | ] | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| [internationalization] | [internationalization] | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -74,8 +74,9 @@ size = Vector3(87.9724, 96.1174, 91.8458) | |||||||
| transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0415039, 58.3319, 0.0198975) | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0415039, 58.3319, 0.0198975) | ||||||
| size = Vector3(43.3174, 26.5295, 43.4319) | size = Vector3(43.3174, 26.5295, 43.4319) | ||||||
| 
 | 
 | ||||||
| [node name="Player" parent="." instance=ExtResource("10_3xiy2")] | [node name="Player" parent="." node_paths=PackedStringArray("Table") instance=ExtResource("10_3xiy2")] | ||||||
| transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.332064, 1.5426, 3.65156) | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.332064, 1.5426, 3.65156) | ||||||
|  | Table = NodePath("../table") | ||||||
| 
 | 
 | ||||||
| [node name="table" parent="." node_paths=PackedStringArray("Hud", "TrenchbroomMap") instance=ExtResource("11_7trvw")] | [node name="table" parent="." node_paths=PackedStringArray("Hud", "TrenchbroomMap") instance=ExtResource("11_7trvw")] | ||||||
| transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 2.83695, 0, -4.36558) | transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 2.83695, 0, -4.36558) | ||||||
|  | |||||||
| @ -29,6 +29,9 @@ namespace Gmtk24 { | |||||||
|         public AudioStreamPlayer3D FootstepPlayer; |         public AudioStreamPlayer3D FootstepPlayer; | ||||||
|         [Export] |         [Export] | ||||||
|         public float FootstepNoiseInterval = 0.25f; |         public float FootstepNoiseInterval = 0.25f; | ||||||
|  |         [ExportCategory("World")] | ||||||
|  |         [Export] | ||||||
|  |         public Table Table; | ||||||
| 
 | 
 | ||||||
|         private float CurrentYaw = 0; |         private float CurrentYaw = 0; | ||||||
|         private float CurrentPitch = 0; |         private float CurrentPitch = 0; | ||||||
| @ -62,6 +65,16 @@ namespace Gmtk24 { | |||||||
|                 } |                 } | ||||||
|                 GetViewport().SetInputAsHandled(); |                 GetViewport().SetInputAsHandled(); | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |             if (@event.IsActionPressed("toggle_table") && !Table.Orbit.IsEnabled) { | ||||||
|  |                 if (Table.IsEnabled) | ||||||
|  |                     Table.DisableTable(); | ||||||
|  |                 else { | ||||||
|  |                     var forward = Eye.Basis * Vector3.Forward; | ||||||
|  |                     forward.Y = 0; | ||||||
|  |                     Table.SpawnTable(Position + forward.Normalized() * 2, Position); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public override void _Process(double delta) { |         public override void _Process(double delta) { | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| using Godot; | using Godot; | ||||||
|  | using System; | ||||||
| using System.Linq; | using System.Linq; | ||||||
| 
 | 
 | ||||||
| namespace Gmtk24 { | namespace Gmtk24 { | ||||||
| @ -36,6 +37,8 @@ namespace Gmtk24 { | |||||||
|         public BuildingBlock GhostBlock; |         public BuildingBlock GhostBlock; | ||||||
|         private Vector3 GhostBlockNormal; |         private Vector3 GhostBlockNormal; | ||||||
| 
 | 
 | ||||||
|  |         public bool IsEnabled { get => Visible == true; } | ||||||
|  | 
 | ||||||
|         // Called when the node enters the scene tree for the first time. |         // Called when the node enters the scene tree for the first time. | ||||||
|         public override void _Ready() { |         public override void _Ready() { | ||||||
|             Orbit.Hud = Hud; |             Orbit.Hud = Hud; | ||||||
| @ -169,5 +172,22 @@ namespace Gmtk24 { | |||||||
|             Plane.Visible = false; |             Plane.Visible = false; | ||||||
|             Plane.ProcessMode = ProcessModeEnum.Disabled; |             Plane.ProcessMode = ProcessModeEnum.Disabled; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         public void DisableTable() { | ||||||
|  |             Visible = false; | ||||||
|  |             ProcessMode = ProcessModeEnum.Disabled; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public void SpawnTable(Vector3 position, Vector3 lookAt) { | ||||||
|  |             if (IsEnabled) | ||||||
|  |                 return; | ||||||
|  | 
 | ||||||
|  |             Visible = true; | ||||||
|  |             ProcessMode = ProcessModeEnum.Pausable; | ||||||
|  |             Position = position; | ||||||
|  |             lookAt.Y = 0; | ||||||
|  |             LookAt(lookAt); | ||||||
|  |             Rotate(Vector3.Up, (float)Math.PI / 2); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user