-
Notifications
You must be signed in to change notification settings - Fork 0
/
mai4906.tmp
139 lines (99 loc) · 4.53 KB
/
mai4906.tmp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
[gd_scene load_steps=11 format=3 uid="uid://ber28avkqievq"]
[ext_resource type="PackedScene" uid="uid://d4h0f6rehmo0c" path="res://Lightsaber.tscn" id="1_a1qa8"]
[ext_resource type="PackedScene" uid="uid://xyp0tfguhqn2" path="res://enemy.tscn" id="2_4rbjo"]
[ext_resource type="PackedScene" uid="uid://b6bk2pj8vbj28" path="res://addons/godot-xr-tools/functions/movement_turn.tscn" id="2_tjojp"]
[ext_resource type="PackedScene" uid="uid://bl2nuu3qhlb5k" path="res://addons/godot-xr-tools/functions/movement_direct.tscn" id="3_bkaat"]
[ext_resource type="PackedScene" uid="uid://fiul51tsyoop" path="res://addons/godot-xr-tools/functions/function_teleport.tscn" id="4_f1fvs"]
[ext_resource type="PackedScene" uid="uid://diyu06cw06syv" path="res://addons/godot-xr-tools/player/player_body.tscn" id="5_uvf28"]
[ext_resource type="PackedScene" path="res://Hanger.tscn" id="7_860nv"]
[sub_resource type="GDScript" id="GDScript_2jau5"]
script/source = "extends Node3D
var xr_interface: XRInterface
var enemiesAlive
var enemiesGoal
var enemiesCreated
var round = 0
func startXR():
xr_interface = XRServer.find_interface(\"OpenXR\")
if xr_interface and xr_interface.is_initialized():
print(\"OpenXR initialised successfully\")
# Turn off v-sync!
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)
# Change our main viewport to output to the HMD
get_viewport().use_xr = true
else:
print(\"OpenXR not initialized, please check if your headset is connected\")
func _ready():
print(\"Ready\")
startXR()
newRound()
$enemy1.connect(\"on_enemy_died\", this, \"enemydied\")
func _process(delta):
pass
func getEnemiesNum():
return (round ** 1.3) + 3
func newRound():
print(\"Rount \", round, \" starting...\")
round += 1
enemiesCreated = 0
enemiesAlive = 0
enemiesGoal = getEnemiesNum()
$Timer.start()
func enemy_died():
print(\"signal received from enemy\")
enemiesAlive -= 1
if enemiesAlive == 0:
newRound()
func _on_timer_timeout(): #add enemy
print(\"timeout\")
if enemiesCreated < enemiesGoal:
print(\"new enemy created\")
enemiesCreated += 1
var enemyScene = load(\"res://enemy.tscn\")
var enemyInstance = enemyScene.instantiate()
add_child(enemyInstance)
#enemyInstance.connect(\"on_enemy_died\", self, \"enemy_died\")
enemyInstance.global_position = global_position + Vector3(cos(enemiesCreated/PI) * randi_range(1, 5), 3, sin(enemiesCreated/PI) * randi_range(0, 5))
else:
print(\"stopping timer\")
$Timer.stop()
"
[sub_resource type="PlaneMesh" id="PlaneMesh_5rya1"]
size = Vector2(45, 45)
[sub_resource type="BoxShape3D" id="BoxShape3D_vt1cu"]
size = Vector3(45, 1, 45)
[node name="Main" type="Node3D"]
script = SubResource("GDScript_2jau5")
[node name="XROrigin3D" type="XROrigin3D" parent="."]
[node name="XRCamera3D" type="XRCamera3D" parent="XROrigin3D"]
[node name="rightHand" type="XRController3D" parent="XROrigin3D"]
tracker = &"right_hand"
[node name="lightSaber" parent="XROrigin3D/rightHand" instance=ExtResource("1_a1qa8")]
transform = Transform3D(0.3, 0, 0, 0, -1.31134e-08, 0.3, 0, -0.3, -1.31134e-08, 0, 0, 0)
[node name="MovementTurn" parent="XROrigin3D/rightHand" instance=ExtResource("2_tjojp")]
turn_mode = 2
[node name="leftHand" type="XRController3D" parent="XROrigin3D"]
tracker = &"left_hand"
[node name="FunctionTeleport" parent="XROrigin3D/leftHand" instance=ExtResource("4_f1fvs")]
[node name="MovementDirect" parent="XROrigin3D/leftHand" instance=ExtResource("3_bkaat")]
strafe = true
[node name="PlayerBody" parent="XROrigin3D" instance=ExtResource("5_uvf28")]
collision_layer = 2
collision_mask = 7
[node name="Ground" type="StaticBody3D" parent="."]
collision_layer = 4
collision_mask = 31
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
mesh = SubResource("PlaneMesh_5rya1")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
shape = SubResource("BoxShape3D_vt1cu")
[node name="enemy1" parent="." instance=ExtResource("2_4rbjo")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.914, 0.5, -3.684)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 5.04301, -0.0987598)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
[node name="Room" parent="." instance=ExtResource("7_860nv")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00041461, 0, 0.334154)
[node name="Timer" type="Timer" parent="."]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]