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 }