コード例 #1
0
    public void ChooseAnOption(int choice)
    {
        Debug.Log("ChooseAnOption(int choice)");

        string choiceTypeString = choiceType.ToString();

        if (choiceType == ChoiceType.Theme)
        {
            chooseBetweenOptionsGiven.ChooseTheme(choice);
        }

        else if (choiceType == ChoiceType.Minion)
        {
            chooseBetweenOptionsGiven.ChooseMinion(choice);
        }

        else if (choiceType == ChoiceType.Modifier)
        {
            chooseBetweenOptionsGiven.ChooseModifier(choice);
        }

        if (triggeredOnce)
        {
            return;
        }

        chooseBetweenOptionsGiven.LockSelectedChoice(choiceTypeString);
        buttonSounds.OnChoiceMade();
        triggeredOnce = true;
        //Debug.Log(p2HasVoted.ToString() + " " + p3HasVoted.ToString() + " " + p4HasVoted.ToString());
        //Debug.Log("2: " + playerVotes[0] + " - 3: " + playerVotes[1] + " - 4: " + playerVotes[2]);
        return;
    }
コード例 #2
0
    private void Update()
    {
        #region Alternate/ControllerInput
        //Debug.Log(Input.GetAxis(p1SelectAltAxisName) + " P1 Horizontal axis input");
        if (Input.GetAxis(p1SelectAltAxisName) != 0 && !pressedDownHorizontalAxis)
        {
            pressedDownHorizontalAxis = true;
            horizontalAxisValue       = Input.GetAxis(p1SelectAltAxisName);
        }
        if (Input.GetAxis(p1SelectAltAxisName) == 0)
        {
            pressedDownHorizontalAxis = false;
        }
        #endregion Alternate/ControllerInput


        if (selected == true && lockedIn == false)
        {
            if (choiceType == "Character")
            {
                chooseBetweenOptionsScript.ChooseCharacter(choice + 1);
            }
            else if (choiceType == "Item")
            {
                chooseBetweenOptionsScript.ChooseItem(choice + 1);
            }
            chooseBetweenOptionsScript.LockSelectedChoice(choiceType);

            buttonSounds.OnChoiceMade();
            //transitionNarrator.DoNarration();

            lockedIn = true;
            return;
        }

        if (lockedIn == false)
        {
            if (Input.GetKeyDown(p1Left) || horizontalAxisValue < 0)
            {
                int selection = (choice + (amountOfChoices - 1)) % amountOfChoices; //Move leftwards in choices.
                ChangeAndDisplaySelection(selection);
                horizontalAxisValue = 0;
            }
            if (Input.GetKeyDown(p1Right) || horizontalAxisValue > 0)
            {
                int selection = (choice + (amountOfChoices + 1)) % amountOfChoices; //Move right in choices.
                ChangeAndDisplaySelection(selection);
                horizontalAxisValue = 0;
            }
            if (Input.GetKeyDown(p1Select) || Input.GetKeyDown(p1SelectAlt))
            {
                selected = true;
            }
        }
    }
コード例 #3
0
    private void Update()
    {
        if (selected == true && lockedIn == false)
        {
            if (choiceType == "Theme")
            {
                chooseBetweenOptionsScript.ChooseTheme(choice + 1);
            }
            else if (choiceType == "Minion")
            {
                chooseBetweenOptionsScript.ChooseMinion(choice + 1);
            }
            else if (choiceType == "Modifier")
            {
                chooseBetweenOptionsScript.ChooseModifier(choice + 1);
            }
            chooseBetweenOptionsScript.LockSelectedChoice(choiceType);

            buttonSounds.OnChoiceMade();
            //transitionNarrator.DoNarration();

            lockedIn = true;
            return;
        }

        if (lockedIn == false)
        {
            if (Input.GetKeyDown(p2Left))
            {
                int selection = (choice + (amountOfChoices - 1)) % amountOfChoices; //Move leftwards in choices.
                ChangeAndDisplaySelection(selection);
            }
            if (Input.GetKeyDown(p2Right))
            {
                int selection = (choice + (amountOfChoices + 1)) % amountOfChoices; //Move right in choices.
                ChangeAndDisplaySelection(selection);
            }
            if (Input.GetKeyDown(p2Select))
            {
                selected = true;
            }
        }
    }
コード例 #4
0
 public void SelectAButton()
 {
     buttonSounds.OnChoiceMade();
 }
コード例 #5
0
    public void Update()
    {
        if (p2LockedIn && p3LockedIn && p4LockedIn && lockedIn == false)
        {
            /*
             * for (int i = 0; i < choices.Length; i++)
             * {
             *  Debug.Log("Heyeyeyayayayyayaaa");
             *  runTimeChoices.chosenGods[i] = chooseableGods[choices[i]];
             * }
             */

            //transitionNarrator.DoNarration();

            if (runTimeChoices.chosenGods[2] == null)
            {
                runTimeChoices.chosenGods[2] = runTimeChoices.chosenGods[0];
            }
            if (runTimeChoices.chosenGods[1] == null)
            {
                runTimeChoices.chosenGods[1] = runTimeChoices.chosenGods[0];
            }

            Invoke("LoadTransition", 1.5f);
            lockedIn = true;
            return;
        }

        //Messy input-region. Couldn't think of a more concise way to write this without having to make God-Objects to draw from in this script. Not perfect.
        #region Inputs
        int currentPlayerIndex = p2Index; //Index of the player whose character we're checking inputs for.
        if (!p2LockedIn)
        {
            bool  p2leftPressed  = false;
            bool  p2rightPressed = false;
            float p2HoriInput    = Input.GetAxis(p2HorizontalAxisName);
            //Debug.Log(p2HoriInput);
            if (p2HoriInput != 0 && !p2WaitForNextClick)
            {
                p2leftPressed      = p2HoriInput < 0 ? true : false;
                p2rightPressed     = !p2leftPressed;
                p2WaitForNextClick = true;
            }
            if (p2HoriInput == 0)
            {
                p2WaitForNextClick = false;
            }

            if (Input.GetKeyDown(p2left) || p2leftPressed)
            {
                int selection = (choices[currentPlayerIndex] + (amountOfChoices - 1)) % amountOfChoices; //Move leftwards in choices.
                ChangeAndDisplaySelection(currentPlayerIndex, selection);
            }
            if (Input.GetKeyDown(p2right) || p2rightPressed)
            {
                int selection = (choices[currentPlayerIndex] + (amountOfChoices + 1)) % amountOfChoices; //Move right in choices.
                ChangeAndDisplaySelection(currentPlayerIndex, selection);
            }
            if (Input.GetKeyDown(p2select) || Input.GetKeyDown(p2SelectAlt))
            {
                //Debug.Log("P2 chose hero");
                p2LockedIn = true;
                UpdateHoverVisuals(0);

                runTimeChoices.chosenGods[0] = chooseableGods[choices[0]];
                audioList = FindObjectOfType <AudioList>();
                audioList.OnGodPicked(2);
                buttonSounds.OnChoiceMade();

                if (gamesettings.GetAmountOfPlayers() == 2)
                {
                    p3LockedIn = true;
                    p4LockedIn = true;
                }
            }
        }


        currentPlayerIndex = p3Index;
        if (!p3LockedIn)
        {
            bool  p3leftPressed  = false;
            bool  p3rightPressed = false;
            float p3HoriInput    = Input.GetAxis(p3HorizontalAxisName);
            if (p3HoriInput != 0 && p3WaitForNextClick)
            {
                p3leftPressed      = p3HoriInput < 0 ? true : false;
                p3rightPressed     = !p3leftPressed;
                p3WaitForNextClick = true;
            }
            if (p3HoriInput == 0)
            {
                p3WaitForNextClick = false;
            }

            if (Input.GetKeyDown(p3left) || p3leftPressed)
            {
                int selection = (choices[currentPlayerIndex] + (amountOfChoices - 1)) % amountOfChoices;
                ChangeAndDisplaySelection(currentPlayerIndex, selection);
            }
            if (Input.GetKeyDown(p3right) || p3leftPressed)
            {
                int selection = (choices[currentPlayerIndex] + (amountOfChoices + 1)) % amountOfChoices; //Move leftwards in choices.
                ChangeAndDisplaySelection(currentPlayerIndex, selection);
            }
            if (Input.GetKeyDown(p3select) || Input.GetKeyDown(p3SelectAlt))
            {
                p3LockedIn = true;
                UpdateHoverVisuals(1);
                runTimeChoices.chosenGods[1] = chooseableGods[choices[1]];
                FindObjectOfType <AudioList>().OnGodPicked(3);
                buttonSounds.OnChoiceMade();
            }
        }

        currentPlayerIndex = p4Index;
        if (!p4LockedIn)
        {
            bool  p4leftPressed  = false;
            bool  p4rightPressed = false;
            float p4HoriInput    = Input.GetAxis(p4HorizontalAxisName);
            if (p4HoriInput != 0 && p4WaitForNextClick)
            {
                p4leftPressed      = p4HoriInput < 0 ? true : false;
                p4rightPressed     = !p4leftPressed;
                p4WaitForNextClick = true;
            }
            if (p4HoriInput == 0)
            {
                p4WaitForNextClick = false;
            }

            if (Input.GetKeyDown(p4left) || p4leftPressed)
            {
                int selection = (choices[currentPlayerIndex] + (amountOfChoices - 1)) % amountOfChoices;
                ChangeAndDisplaySelection(currentPlayerIndex, selection);
            }
            if (Input.GetKeyDown(p4right) || p4rightPressed)
            {
                int selection = (choices[currentPlayerIndex] + (amountOfChoices + 1)) % amountOfChoices;
                ChangeAndDisplaySelection(currentPlayerIndex, selection);
            }
            if (Input.GetKeyDown(p4select) || Input.GetKeyDown(p4SelectAlt))
            {
                p4LockedIn = true;
                UpdateHoverVisuals(2);
                runTimeChoices.chosenGods[2] = chooseableGods[choices[2]];
                FindObjectOfType <AudioList>().OnGodPicked(4);
                buttonSounds.OnChoiceMade();
            }
        }
        #endregion Inputs
    }