content/hifi-content/davidback/development/shortbow/shortbowServerEntity.js
2022-02-13 22:49:05 +01:00

32 lines
No EOL
997 B
JavaScript

(function() {
Script.include('utils.js');
Script.include('shortbow.js');
Script.include('shortbowGameManager.js');
TEMPLATES = SHORTBOW_ENTITIES.Entities;
this.entityID = null;
var gameManager = null;
this.preload = function(entityID) {
this.entityID = entityID;
var bowPositions = [];
var spawnPositions = [];
for (var i = 0; i < TEMPLATES.length; ++i) {
var template = TEMPLATES[i];
if (template.name === "SB.BowSpawn") {
bowPositions.push(template.localPosition);
} else if (template.name === "SB.EnemySpawn") {
spawnPositions.push(template.localPosition);
}
}
gameManager = new ShortbowGameManager(this.entityID, bowPositions, spawnPositions);
};
this.unload = function() {
if (gameManager) {
gameManager.cleanup();
gameManager = null;
}
};
});