// Prototypes var gs_wait = function() { this.name = "gs_wait"; this.enter = function() { debugPrint("Enter: " + this.name); }; this.update = function(deltaTime) { // Listen for connection from player client // Wait some time for all players to log-in and join the group. debugPrint("update: " + this.name + " d=" + deltaTime); }; this.exit = function() { debugPrint("Exit: " + this.name); }; }; var gs_missionBrief = function() { this.name = "gs_missionBrief"; this.enter = function() { debugPrint("Enter: " + "gs_missionBrief"); // Reset mission parameters: targets, etc. }; this.update = function(deltaTime) { // Wait for explanation of mission to finish. }; this.exit = function() { // Load new features of landscape based on chosen mission. // Enable player scanning/manipulation/game play features. }; }; var gs_missionRunning = function() { this.name = "gs_missionRunning"; this.enter = function() { debugPrint("Enter: " + this.name); }; this.update = function(deltaTime) { // Check for number of targets acquired. // Check for environmental changes }; this.exit = function() { debugPrint("Exit: " + this.name); }; }; function inheritsFrom(child, parent) { child.prototype = Object.create(parent.prototype); }; // Helpers function changeGameState(newState) { if (_gameState != undefined) _gameState.exit(); _gameState = newState; _gameState.enter(); } function debugPrint(message) { //console.log(message); print(message); } var eMissionType = { water : 0, mineral : 1, plant : 2, animal : 3 }; var Mission = { name : "", introAudioUrl : "", targetPoints : [], targetModelUrl : "" }; var _gameState = null; // Initialize everything function gameInit() { changeGameState(new gs_wait()); } function checkAvatars() { } function onUpdate(deltaTime) { _gameState.update(deltaTime); } gameInit(); Script.update.connect(onUpdate);