//Enables physics areas based off the question state
    public void EnableCGFAreas(QuestionManager.QuestionState questionState, bool positiveForce = false)
    {
        switch (questionState)
        {
        case QuestionManager.QuestionState.None:

            //CGF Areas
            foreach (var cgf in PollCgfs)
            {
                cgf.Enable = false;

                if (positiveForce)
                {
                    cgf.ForcePower = Mathf.Abs(cgf.ForcePower);
                }
                else
                {
                    cgf.ForcePower = -Mathf.Abs(cgf.ForcePower);
                }
            }
            foreach (var cgf in MultipleChoiceCgfs)
            {
                cgf.Enable = false;

                if (positiveForce)
                {
                    cgf.ForcePower = Mathf.Abs(cgf.ForcePower);
                }
                else
                {
                    cgf.ForcePower = -Mathf.Abs(cgf.ForcePower);
                }
            }

            break;

        case QuestionManager.QuestionState.Poll:

            //CGF Areas
            foreach (var cgf in PollCgfs)
            {
                cgf.Enable = true;

                if (positiveForce)
                {
                    cgf.ForcePower = Mathf.Abs(cgf.ForcePower);
                }
                else
                {
                    cgf.ForcePower = -Mathf.Abs(cgf.ForcePower);
                }
            }
            foreach (var cgf in MultipleChoiceCgfs)
            {
                cgf.Enable = false;

                if (positiveForce)
                {
                    cgf.ForcePower = Mathf.Abs(cgf.ForcePower);
                }
                else
                {
                    cgf.ForcePower = -Mathf.Abs(cgf.ForcePower);
                }
            }

            break;

        case QuestionManager.QuestionState.MultipleChoice:

            //CGF Areas
            foreach (var cgf in PollCgfs)
            {
                cgf.Enable = false;

                if (positiveForce)
                {
                    cgf.ForcePower = Mathf.Abs(cgf.ForcePower);
                }
                else
                {
                    cgf.ForcePower = -Mathf.Abs(cgf.ForcePower);
                }
            }
            foreach (var cgf in MultipleChoiceCgfs)
            {
                cgf.Enable = true;

                if (positiveForce)
                {
                    cgf.ForcePower = Mathf.Abs(cgf.ForcePower);
                }
                else
                {
                    cgf.ForcePower = -Mathf.Abs(cgf.ForcePower);
                }
            }

            break;

        case QuestionManager.QuestionState.ScatterPlot:

            //CGF Areas
            foreach (var cgf in PollCgfs)
            {
                cgf.Enable = false;

                if (positiveForce)
                {
                    cgf.ForcePower = Mathf.Abs(cgf.ForcePower);
                }
                else
                {
                    cgf.ForcePower = -Mathf.Abs(cgf.ForcePower);
                }
            }

            foreach (var cgf in MultipleChoiceCgfs)
            {
                cgf.Enable = false;

                if (positiveForce)
                {
                    cgf.ForcePower = Mathf.Abs(cgf.ForcePower);
                }
                else
                {
                    cgf.ForcePower = -Mathf.Abs(cgf.ForcePower);
                }
            }

            break;
        }
    }
Exemplo n.º 2
0
    //Syncs the cube votes
    public void SyncCubeVotes(QuestionManager.QuestionState questionState, bool part2 = false)
    {
        SyncTimeDelay();
        SyncSpawnTime();

        if (TimeDelayCountDown > TimeDelaySeconds)
        {
            if (SpawnCountDown > SpawnSeconds)
            {
                switch (questionState)
                {
                case QuestionManager.QuestionState.None:
                    break;

                case QuestionManager.QuestionState.Poll:
                    if (answer1Counter < Core.Instance._questionManager.Answer1Records)
                    {
                        Core.Instance._spawnManager.DefaultCubes.Spawn();
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.tag = "Answer 1";
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().QuestionState = QuestionManager.QuestionState.Poll;

                        answer1Counter++;
                    }
                    if (answer2Counter < Core.Instance._questionManager.Answer2Records)
                    {
                        Core.Instance._spawnManager.DefaultCubes.Spawn();
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.tag = "Answer 2";
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().QuestionState = QuestionManager.QuestionState.Poll;
                        answer2Counter++;
                    }
                    break;

                case QuestionManager.QuestionState.MultipleChoice:
                    if (answer1Counter < Core.Instance._questionManager.Answer1Records)
                    {
                        Core.Instance._spawnManager.DefaultCubes.Spawn();
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.tag = "Answer 1";
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().QuestionState = QuestionManager.QuestionState.MultipleChoice;
                        answer1Counter++;
                    }
                    if (answer2Counter < Core.Instance._questionManager.Answer2Records)
                    {
                        Core.Instance._spawnManager.DefaultCubes.Spawn();
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.tag = "Answer 2";
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().QuestionState = QuestionManager.QuestionState.MultipleChoice;
                        answer2Counter++;
                    }
                    if (answer3Counter < Core.Instance._questionManager.Answer3Records)
                    {
                        Core.Instance._spawnManager.DefaultCubes.Spawn();
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.tag = "Answer 3";
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().QuestionState = QuestionManager.QuestionState.MultipleChoice;
                        answer3Counter++;
                    }
                    break;

                case QuestionManager.QuestionState.ScatterPlot:

                    if (answer1Counter < Core.Instance._questionManager.AnswerVectorRecords.Count)
                    {
                        Core.Instance._spawnManager.DefaultCubes.Spawn();
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.tag = "Scatter";
                        Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().QuestionState = QuestionManager.QuestionState.ScatterPlot;

                        if (!part2)
                        {
                            float pivot_x = -35f;
                            float z       = 32.5f;

                            Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().StopAtTarget = true;
                            Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().Target       = new Vector3(pivot_x + (70f * Core.Instance._questionManager.AnswerVectorRecords[answer1Counter].x), Random.Range(9f, 15f), z);
                        }
                        else
                        {
                            float pivot_x = -32f;
                            float pivot_z = -12f;
                            float z       = 32.5f;

                            Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().StopAtTarget = false;
                            Core.Instance._spawnManager.DefaultCubes.LastSpawned.GetComponent <CubeDefault>().Target       = new Vector3(pivot_x + (64f * Core.Instance._questionManager.AnswerVectorRecords[answer1Counter].x), pivot_z + (24f * Core.Instance._questionManager.AnswerVectorRecords[answer1Counter].y), z);
                        }

                        answer1Counter++;
                    }

                    break;
                }

                timeSpawnStamp = 0;
            }
        }
    }
    //Enables trigger areas based on the question state
    public void EnableTriggerAreas(QuestionManager.QuestionState questionState)
    {
        switch (questionState)
        {
        case QuestionManager.QuestionState.None:

            //Trigger Areas
            AmbientTrigger.SetActive(true);
            PollTrigger.SetActive(false);
            MultipleChoiceTrigger.SetActive(false);
            ScatterPlotTrigger.SetActive(false);

            //CGF Areas
            foreach (var cgf in PollCgfs)
            {
                cgf.Enable = false;
            }
            foreach (var cgf in MultipleChoiceCgfs)
            {
                cgf.Enable = false;
            }

            break;

        case QuestionManager.QuestionState.Poll:

            //Trigger Areas
            AmbientTrigger.SetActive(false);
            PollTrigger.SetActive(true);
            MultipleChoiceTrigger.SetActive(false);
            ScatterPlotTrigger.SetActive(false);

            //CGF Areas
            foreach (var cgf in PollCgfs)
            {
                cgf.Enable = true;
            }
            foreach (var cgf in MultipleChoiceCgfs)
            {
                cgf.Enable = false;
            }

            break;

        case QuestionManager.QuestionState.MultipleChoice:

            //Trigger Areas
            AmbientTrigger.SetActive(false);
            PollTrigger.SetActive(false);
            MultipleChoiceTrigger.SetActive(true);
            ScatterPlotTrigger.SetActive(false);

            //CGF Areas
            foreach (var cgf in PollCgfs)
            {
                cgf.Enable = false;
            }
            foreach (var cgf in MultipleChoiceCgfs)
            {
                cgf.Enable = true;
            }

            break;

        case QuestionManager.QuestionState.ScatterPlot:

            //Trigger Areas
            AmbientTrigger.SetActive(false);
            PollTrigger.SetActive(false);
            MultipleChoiceTrigger.SetActive(false);
            ScatterPlotTrigger.SetActive(true);

            //CGF Areas
            foreach (var cgf in PollCgfs)
            {
                cgf.Enable = false;
            }
            foreach (var cgf in MultipleChoiceCgfs)
            {
                cgf.Enable = false;
            }

            break;
        }
    }