Пример #1
0
    public void RelinquishControl(InteractiveParticipant participant = null)
    {
        var group = InteractivityManager.SingletonInstance.GetGroup("default");

        (participant ?? this.participant).Group = group;
        sessionId = null;
        SaveMaster.SyncSave();
    }
Пример #2
0
        private void SyncSave()
        {
            var stopWatch = new System.Diagnostics.Stopwatch();

            stopWatch.Start();

            SaveMaster.SyncSave();

            stopWatch.Stop();
            displayText.text = stopWatch.Elapsed.TotalMilliseconds.ToString();
        }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        var allTheNeeds = GameObject.FindObjectsOfType <Needy>();


        iTime -= Time.deltaTime;

        if (!Inman.I.HasPlayer)
        {
            iTime = maxITime;
            currentlyPlaying.text = "Nobody ";
        }

        var playtime = Inman.I.HasPlayer ? Mathf.Max(Inman.I.playTime - (Time.time - Inman.I.joinTime), 0) : 0;
        var showName = Inman.I.HasPlayer ? Inman.I.username : "******";

        currentlyPlaying.text = $"{showName} is taking care of the plant and has {playtime}s of exlusive time";
        var freeze = iTime > 0;


        var  failed    = false;
        Need faileNeed = null;

        foreach (var need in allTheNeeds)
        {
            need.Freeze = freeze;

            if (!freeze && need.balance <= 0)
            {
                failed    = true;
                faileNeed = need.need;
            }
        }
        failed &= !freeze;
        if (failed)
        {
            SaveMaster.SyncLoad();
            Newspaper.I.Report(Inman.I.username, faileNeed);
            Inman.I.RelinquishControl();
            iTime = maxITime;
        }

        if (Input.GetKeyDown(KeyCode.F5))
        {
            SaveMaster.SyncSave();
        }
        if (Input.GetKeyDown(KeyCode.F9))
        {
            SaveMaster.SyncLoad();
        }
    }