Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roque
erp5
Commits
a32b9a79
Commit
a32b9a79
authored
Sep 27, 2022
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WEB-WORKER] [WIP] move all game logic into one file (WIP)
parent
a6c32ef0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
24 deletions
+21
-24
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_logic_js.js
...TemplateItem/web_page_module/drone_web_worker_logic_js.js
+19
-22
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_logic_js.xml
...emplateItem/web_page_module/drone_web_worker_logic_js.xml
+2
-2
No files found.
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_logic_js.js
View file @
a32b9a79
...
...
@@ -498,13 +498,11 @@ var GameManager = /** @class */ (function () {
ctx
.
_map_swapped
=
true
;
}
console
.
log
(
"
APIs created
"
);
// Set the AI code into drones
var
AIcodeEval
,
AIcodeLeft
;
//TODO rename all left/team/'L'
AIcodeLeft
=
ctx
.
_script
;
// Init the map
_this
.
_mapManager
=
new
MapManager
(
ctx
.
_scene
);
console
.
log
(
"
Map manager instantiated
"
);
ctx
.
_spawnDrones
(
GAMEPARAMETERS
.
dronesPosition
,
GAMEPARAMETERS
.
droneList
,
AIcodeLeft
);
ctx
.
_spawnDrones
(
GAMEPARAMETERS
.
dronesPosition
,
GAMEPARAMETERS
.
droneList
,
ctx
.
_script
);
// Hide the drone prefab
DroneManager
.
Prefab
.
isVisible
=
false
;
//Hack to make advanced texture work
...
...
@@ -667,29 +665,13 @@ var GameManager = /** @class */ (function () {
}
return
false
;
}
for
(
i
=
0
;
i
<
drone_list
.
length
;
i
+=
1
)
{
position
=
randomSpherePoint
(
center
.
x
+
i
,
center
.
y
+
i
,
center
.
z
+
i
,
0
,
0
,
0
);
if
(
checkCollision
(
position
,
position_list
)
||
position
.
z
<
0.05
)
{
collision_nb
+=
1
;
if
(
collision_nb
<
max_collision
)
{
i
-=
1
;
}
}
else
{
position_list
.
push
(
position
);
var
api
=
new
this
.
APIs_dict
[
drone_list
[
i
]](
this
,
"
L
"
,
GAMEPARAMETERS
.
compareFlights
);
//TODO drip L team in DroneAPI
this
.
_setSpawnDrone
(
position
.
x
,
position
.
y
,
position
.
z
,
i
,
api
,
code
);
}
}
};
GameManager
.
prototype
.
_setSpawnDrone
=
function
(
x
,
y
,
z
,
index
,
api
,
code
)
{
function
spawnDrone
(
x
,
y
,
z
,
index
,
api
,
code
,
ctx
)
{
var
default_drone_AI
=
api
.
getDroneAI
();
if
(
default_drone_AI
)
{
code
=
default_drone_AI
;
}
var
team
=
"
L
"
;
//TODO DROP TEAM
var
ctx
=
this
,
base
,
code_eval
=
"
let drone = new DroneManager(ctx._scene,
"
+
var
base
,
code_eval
=
"
let drone = new DroneManager(ctx._scene,
"
+
index
+
'
, "
'
+
team
+
'
", api);
'
+
"
let droneMe = function(NativeDate, me, Math, window, DroneManager, GameManager, DroneLogAPI, DroneAaileFixeAPI, BABYLON, GAMEPARAMETERS) {
"
+
"
var start_time = (new Date(2070, 0, 0, 0, 0, 0, 0)).getTime();
"
+
...
...
@@ -712,6 +694,21 @@ var GameManager = /** @class */ (function () {
catch
(
error
)
{
eval
(
base
);
}
}
for
(
i
=
0
;
i
<
drone_list
.
length
;
i
+=
1
)
{
position
=
randomSpherePoint
(
center
.
x
+
i
,
center
.
y
+
i
,
center
.
z
+
i
,
0
,
0
,
0
);
if
(
checkCollision
(
position
,
position_list
)
||
position
.
z
<
0.05
)
{
collision_nb
+=
1
;
if
(
collision_nb
<
max_collision
)
{
i
-=
1
;
}
}
else
{
position_list
.
push
(
position
);
var
api
=
new
this
.
APIs_dict
[
drone_list
[
i
]](
this
,
"
L
"
,
GAMEPARAMETERS
.
compareFlights
);
//TODO drip L team in DroneAPI
spawnDrone
(
position
.
x
,
position
.
y
,
position
.
z
,
i
,
api
,
code
,
this
);
}
}
};
return
GameManager
;
...
...
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_logic_js.xml
View file @
a32b9a79
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1003.160
08.33206.1152
0
</string>
</value>
<value>
<string>
1003.160
16.1852.3246
0
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
166430
2663.7
</float>
<float>
166430
3078.74
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment