Compare commits

..

No commits in common. "951c9713fa48dc4812ae465926e50d8a41cd0ab3" and "8c8a5e00d729a6dd1815f9afa4c4dfecd834e0a9" have entirely different histories.

3 changed files with 6 additions and 35 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=2] [gd_scene load_steps=18 format=2]
[ext_resource path="res://Scripts/Player.gd" type="Script" id=1] [ext_resource path="res://Scripts/Player.gd" type="Script" id=1]
[ext_resource path="res://Models/Arrow.obj" type="ArrayMesh" id=2] [ext_resource path="res://Models/Arrow.obj" type="ArrayMesh" id=2]
@ -14,7 +14,6 @@
[ext_resource path="res://Images/BatteryFilling.png" type="Texture" id=12] [ext_resource path="res://Images/BatteryFilling.png" type="Texture" id=12]
[ext_resource path="res://Images/BatteryBackground.png" type="Texture" id=13] [ext_resource path="res://Images/BatteryBackground.png" type="Texture" id=13]
[ext_resource path="res://Models/cone-collision.tres" type="Shape" id=14] [ext_resource path="res://Models/cone-collision.tres" type="Shape" id=14]
[ext_resource path="res://Models/Cone.obj" type="ArrayMesh" id=15]
[sub_resource type="CapsuleShape" id=1] [sub_resource type="CapsuleShape" id=1]
radius = 0.15 radius = 0.15
@ -479,11 +478,6 @@ angular_damp = 0.0
transform = Transform( 25, 0, 0, 0, -4.07302e-06, -100, 0, 25, -1.62921e-05, 0, 1000, 0 ) transform = Transform( 25, 0, 0, 0, -4.07302e-06, -100, 0, 25, -1.62921e-05, 0, 1000, 0 )
shape = ExtResource( 14 ) shape = ExtResource( 14 )
[node name="Cone" type="MeshInstance" parent="GunContainer/Cone/CollisionShape"]
visible = false
mesh = ExtResource( 15 )
material/0 = ExtResource( 4 )
[node name="spaceship-gun" parent="GunContainer" instance=ExtResource( 10 )] [node name="spaceship-gun" parent="GunContainer" instance=ExtResource( 10 )]
transform = Transform( 1, 0, 1.64203e-15, 0, 1, 0, 1.64203e-15, 0, 1, 4.47035e-08, 0.811224, -3.54597e-08 ) transform = Transform( 1, 0, 1.64203e-15, 0, 1, 0, 1.64203e-15, 0, 1, 4.47035e-08, 0.811224, -3.54597e-08 )
@ -577,18 +571,6 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="WeaponVisualiserMenu" type="OptionButton" parent="WeaponsPanel"]
anchor_left = 0.5
anchor_top = 0.8
anchor_right = 0.5
anchor_bottom = 0.8
margin_left = -50.0
margin_right = 50.0
grow_horizontal = 2
text = "None"
items = [ "None", null, false, 0, null, "Self", null, false, 1, null, "Everyone", null, false, 2, null ]
selected = 0
[node name="StatusPanel" type="Panel" parent="."] [node name="StatusPanel" type="Panel" parent="."]
visible = false visible = false
anchor_left = 0.5 anchor_left = 0.5
@ -663,4 +645,3 @@ margin_bottom = -10.0
[connection signal="pressed" from="ThrustPanel/ResetButton" to="." method="_on_ResetButton_pressed"] [connection signal="pressed" from="ThrustPanel/ResetButton" to="." method="_on_ResetButton_pressed"]
[connection signal="body_entered" from="GunContainer/Cone" to="." method="_on_player_enter_firing_arc"] [connection signal="body_entered" from="GunContainer/Cone" to="." method="_on_player_enter_firing_arc"]
[connection signal="body_exited" from="GunContainer/Cone" to="." method="_on_player_exit_firing_arc"] [connection signal="body_exited" from="GunContainer/Cone" to="." method="_on_player_exit_firing_arc"]
[connection signal="item_selected" from="WeaponsPanel/WeaponVisualiserMenu" to="." method="_on_WeaponVisualiserMenu_item_selected"]

View File

@ -38,10 +38,12 @@ remote func declare_winner(name : String) -> void:
winner_name = "Victor: " + name winner_name = "Victor: " + name
$WinnerPanel/WinnerLabel.text = winner_name $WinnerPanel/WinnerLabel.text = winner_name
func show_winner() -> void: func show_winner() -> void:
if winner_name != null: if winner_name != null:
$WinnerPanel.visible = true $WinnerPanel.visible = true
func _on_RematchButton_pressed(): func _on_RematchButton_pressed():
$WinnerPanel/RematchButton.disabled = true $WinnerPanel/RematchButton.disabled = true
$Camera.clear_register() $Camera.clear_register()
@ -51,10 +53,9 @@ func _on_RematchButton_pressed():
winner_name = null winner_name = null
rpc_id(1, "request_rematch", get_tree().get_network_unique_id()) rpc_id(1, "request_rematch", get_tree().get_network_unique_id())
func _on_ExitButton_pressed(): func _on_ExitButton_pressed():
get_parent().exit_button_pressed() get_parent().exit_button_pressed()
func set_all_firing_arc_visibilities(toggle : bool) -> void:
for player in players.values():
player.set_firing_arc_visibility(toggle)

View File

@ -522,6 +522,7 @@ func _fire_gun(delta : float) -> void:
if closest_enemy != null: if closest_enemy != null:
$GunContainer/RayCast.look_at($GunContainer/RayCast.global_transform.origin - translation, Vector3(0,1,0)) $GunContainer/RayCast.look_at($GunContainer/RayCast.global_transform.origin - translation, Vector3(0,1,0))
#$GunContainer/RayCast.rotate_object_local(Vector3(-1,-1,-1).normalized(), 90.0)
var raycast_pos : Vector3 = $GunContainer/RayCast.global_transform.origin var raycast_pos : Vector3 = $GunContainer/RayCast.global_transform.origin
var target_pos : Vector3 = $GunContainer/RayCast.get_collision_point() var target_pos : Vector3 = $GunContainer/RayCast.get_collision_point()
_update_laser(raycast_pos.distance_to(target_pos)) _update_laser(raycast_pos.distance_to(target_pos))
@ -615,15 +616,3 @@ func _on_player_enter_firing_arc(body):
func _on_player_exit_firing_arc(body): func _on_player_exit_firing_arc(body):
players_in_firing_arc.erase(body) players_in_firing_arc.erase(body)
print(body.name) print(body.name)
func set_firing_arc_visibility(toggle : bool) -> void:
$GunContainer/Cone/CollisionShape/Cone.visible = toggle
func _on_WeaponVisualiserMenu_item_selected(index):
if index == 0:
get_parent().set_all_firing_arc_visibilities(false)
elif index == 1:
get_parent().set_all_firing_arc_visibilities(false)
set_firing_arc_visibility(true)
elif index == 2:
get_parent().set_all_firing_arc_visibilities(true)