Esempio n. 1
0
    // Start is called before the first frame update


    void Start()
    {
        pendingPositionsActualizations = new Dictionary <string, Vector3>();
        pendingRotationsActualizations = new Dictionary <string, Quaternion>();
        userCol = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));

        whiteColor = Color.white;
        cyanColor  = Color.cyan;

        playbackColor1 = whiteColor; //new Color(0.8f, 0.8f, 0.8f);
        playbackColor2 = cyanColor;  //new Color(0.6f, 0.6f, 0.6f);

        gameEngine     = FindObjectOfType <GameEngine>();
        scenarioEvents = gameEngine.scenarioEvents;
    }
Esempio n. 2
0
    // The very start of the program
    public IEnumerator InitApplication()
    {
        // basic initialization
        Screen.fullScreen           = false;
        appState                    = AppState.Initializing;
        Application.targetFrameRate = targetFrameRate;

        userManager     = GetComponentInChildren <UserManager>();
        playbackManager = GetComponentInChildren <PlaybackManager>();
        scenarioEvents  = GetComponentInChildren <ScenarioEvents>();

        networkManager = (NetworkManager)FindObjectOfType(typeof(NetworkManager));
        osc            = networkManager.osc;

        uiHandler     = (UIHandler)FindObjectOfType(typeof(UIHandler));
        canvasHandler = uiHandler.GetComponentInChildren <CanvasHandler>();

        fileInOut    = (FileInOut)FindObjectOfType(typeof(FileInOut));
        soundHandler = (SoundHandler)FindObjectOfType(typeof(SoundHandler));
        clock        = (Clock)FindObjectOfType(typeof(Clock));

        canvasHandler.ChangeCanvas("initCanvas");
        //_userRole = UserRole.Server; // base setting
        int t = 0;

        switch (_userRole)
        {
        case UserRole.Server: { t = 0; break; }

        case UserRole.Player: { t = 1;; break; }

        case UserRole.Viewer: { t = 2;; break; }

        case UserRole.Tracker: { t = 3;; break; }

        case UserRole.Playback: { t = 4; break; }
        }

        // load jsons
        fileInOut.LoadPreferencesFiles(this);

        if (gameData.runInLocal == 1)
        {
            gameData.OSC_LocalIP = "127.0.0.1";
        }
        else
        {
            gameData.OSC_LocalIP = CheckIp();
        }

        // change UI's server IP field
        uiHandler.FillServerIPField(gameData.runInLocal, gameData.OSC_ServerIP);

        userManager.keepNamesVisibleForPlayers = (gameData.showNamesAboveHead == 1);


        // adjust user's parameters

        // build is always for non vr use
        if (!Application.isEditor)
        {
            useVRHeadset = false;
            StartCoroutine(EnableDisableVRMode(false));
        }
        else
        {
            useVRHeadset = (gameData.useVr == 1);
            StartCoroutine(EnableDisableVRMode(false));
        }

        if (useVRHeadset)
        {
            uiHandler.SetPlayerNetworkType(1);
        }
        else
        {
            uiHandler.SetPlayerNetworkType(t);
        }

        // do we print sent and received messages
        if (gameData.DebugMode == 1)
        {
            Instantiate(debugPrefab);
            debugMode = true;
        }
        yield return(new WaitForSeconds(1));

        InvokeRepeating("TimedUpdate", 0.5f, 1f / targetFrameRate);
    }
Esempio n. 3
0
 public List <IScenarioEvent> GetScenarioEvents()
 {
     return(ScenarioEvents.Where(_ => _.Turn == Turn).Map(message => message).ToList());
 }