Esempio n. 1
0
    public void WriteLogForTest(bool up)
    {
        string text = "";

        if (up)
        {
            text = string.Format("{0}, {1}, {2}, {3}, {4}, {5}", this.PlayerScript.Id + 1, this.ToString(), this.PlayerScript.TotalMissionPlayerHasCompleted, "UP", ThisButtonPressNumberUp, TimeSinceReceivedMission);
        }
        else if (!up)
        {
            text = string.Format("{0}, {1}, {2}, {3}, {4}, {5}", this.PlayerScript.Id + 1, this.ToString(), this.PlayerScript.TotalMissionPlayerHasCompleted, "DOWN", ThisButtonPressNumberDown, TimeSinceReceivedMission);
        }

        LoggingManager.AddTextNoTimeStamp(text);
    }
Esempio n. 2
0
    void Start()
    {
        Application.runInBackground = true;

        ControllerPlayers = new List <ControllerPlayer>();
        FindAllControllers();

        RumblingRightNow = false;
        RumbleTimer      = 0;
        RumbleInterval   = 1;
        ReadyToGetInput  = false;
        inputCounter     = 0;
        InputTime        = 0;
        usingHelpPaper   = true;

        LoggingManager.CreateTextFile("ControllerTest_");
        LoggingManager.AddTextNoTimeStamp("PlayerID, UsingHelpPaper, RumbleType, RumbleVariation, PlayerAnswer, RumbleDuration, ReactionTime, ReactionTimeMinusRumbleDuration, CorrectButtonPress\n\n");
    }
Esempio n. 3
0
    void Start()
    {
        TimeLeft = TimePerRound;

        CurrentRound = NumberOfRoundsPerGame + 1;

        TargetChosenSoFar = new List <int>();

        HasPlayedAtLeastOnce = false;

        for (int i = Players.Count - 1; i >= 0; i--)
        {
            GameObject p = Players[i];

            if (!p.GetComponent <Player>().HasBeenChosen)
            {
                Players.Remove(p);
                Destroy(p);
            }
        }


        // TODO: make practice rumble things

        /*foreach (GameObject g in Players)
         * {
         *
         *  MissionBase m = new MissionKill();
         *  string scriptName = m.ToString();
         *  g.AddComponent(scriptName);
         *
         *  g.GetComponent<MissionBase>().PraciceRumbles();
         *
         *
         * }*/



        Camera = GameObject.Find("Main Camera").camera;
        if (Camera == null)
        {
            Debug.Log("ERROR - Game Manager needs a link to the camera!");
        }

        if (MainLight == null)
        {
            Debug.Log("ERROR - assign directional light to TextFade");
        }

        if (TimeBar == null)
        {
            Debug.Log("ERROR - assign timebar to Game Manager");
        }


        MissionManager.Instance.GetNewMissions();

        if (UseAnnouncer)
        {
            StartCoroutine(StartCalibrationVoice());
        }
        else
        {
            StartCoroutine(StartRumblePractices());
        }

        if (LogForTest)
        {
            LoggingManager.CreateTextFile();
            string text = "PlayerID, CurrentMissionType, TotalMissionsPlayerHasHadSoFar, ButtonPressType, ThisButtonPressNumber, TimeSinceReceivedMission";
            LoggingManager.AddTextNoTimeStamp(text);
        }
    }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }

        if (RumblingRightNow)
        {
            RumbleTimer += Time.deltaTime;
            CurrentRumble.UpdateRumble();
        }

        //if (ReadyToGetInputPreTime)
        //  PreTime += Time.deltaTime;

        if (ReadyToGetInput)
        {
            InputTime += Time.deltaTime;
        }

        //print(RumbleTimer);

        foreach (ControllerPlayer p in ControllerPlayers)
        {
            p.UpdateState();

            if (ReadyToGetInput)
            {
                if (inputCounter < ControllerPlayers.Count)
                {
                    // pressed
                    if (p.ButtonPressedRightNow(ButtonsToPress.A) == true && !p.HasInputted)
                    {
                        p.HasInputted = true;
                        inputCounter++;

                        float time;
                        time = InputTime;

                        bool correct = CurrentRumble.pattern == ButtonsToPress.A;

                        if (CurrentRumble is RightLeft)
                        {
                            if (CurrentRumble.pattern == ButtonsToPress.A || CurrentRumble.pattern == ButtonsToPress.B)
                            {
                                correct = true;
                            }
                        }

                        string test = string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", (int)p.Index + 1, usingHelpPaper, CurrentRumble.ToString(), CurrentRumble.pattern, ButtonsToPress.A.ToString(), CurrentRumble.RumbleDuration, time, time - CurrentRumble.RumbleDuration, correct);

                        LoggingManager.AddTextNoTimeStamp(test);
                    }

                    if (p.ButtonPressedRightNow(ButtonsToPress.B) == true && !p.HasInputted)
                    {
                        p.HasInputted = true;
                        inputCounter++;

                        float time;
                        time = InputTime;

                        bool correct = CurrentRumble.pattern == ButtonsToPress.B;

                        if (CurrentRumble is RightLeft)
                        {
                            if (CurrentRumble.pattern == ButtonsToPress.B || CurrentRumble.pattern == ButtonsToPress.A)
                            {
                                correct = true;
                            }
                        }

                        string test = string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", (int)p.Index + 1, usingHelpPaper, CurrentRumble.ToString(), CurrentRumble.pattern, ButtonsToPress.B.ToString(), CurrentRumble.RumbleDuration, time, time - CurrentRumble.RumbleDuration, correct);
                        LoggingManager.AddTextNoTimeStamp(test);
                    }

                    if (p.ButtonPressedRightNow(ButtonsToPress.X) == true && !p.HasInputted)
                    {
                        p.HasInputted = true;
                        inputCounter++;

                        float time;
                        time = InputTime;

                        bool correct = CurrentRumble.pattern == ButtonsToPress.X;

                        if (CurrentRumble is RightLeft)
                        {
                            if (CurrentRumble.pattern == ButtonsToPress.X || CurrentRumble.pattern == ButtonsToPress.Y)
                            {
                                correct = true;
                            }
                        }

                        string test = string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", (int)p.Index + 1, usingHelpPaper, CurrentRumble.ToString(), CurrentRumble.pattern, ButtonsToPress.X.ToString(), CurrentRumble.RumbleDuration, time, time - CurrentRumble.RumbleDuration, correct);


                        LoggingManager.AddTextNoTimeStamp(test);
                    }

                    if (p.ButtonPressedRightNow(ButtonsToPress.Y) == true && !p.HasInputted)
                    {
                        p.HasInputted = true;
                        inputCounter++;

                        float time;
                        time = InputTime;

                        bool correct = CurrentRumble.pattern == ButtonsToPress.Y;
                        if (CurrentRumble is RightLeft)
                        {
                            if (CurrentRumble.pattern == ButtonsToPress.Y || CurrentRumble.pattern == ButtonsToPress.X)
                            {
                                correct = true;
                            }
                        }

                        string test = string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}", (int)p.Index + 1, usingHelpPaper, CurrentRumble.ToString(), CurrentRumble.pattern, ButtonsToPress.Y.ToString(), CurrentRumble.RumbleDuration, time, time - CurrentRumble.RumbleDuration, correct);

                        LoggingManager.AddTextNoTimeStamp(test);
                    }
                }
                else
                {
                    ReadyToGetInput = false;
                    //ReadyToGetInputPreTime = false;
                    inputCounter = 0;
                    InputTime    = 0;
                    //PreTime = 0;

                    if (!RumblingRightNow)
                    {
                        RemoveRumble();
                    }
                }
            }

            p.previousState = p.state;
        }
    }