void OnStandaloneKeyDownChecker(StandaloneInputManager.types type) { if (ready) { print(this.gameObject.name); Events.OnSoundFX("ui"); OnStandaloneKeyDown(type); } }
void OnStandaloneKeyDown(StandaloneInputManager.types type) { foreach (StandalonePlayerInputUI button in buttons) { if (button.type == type) { button.Clicked(); } } }
public override void OnStandaloneKeyDown(StandaloneInputManager.types type) { if (state != states.WAITING_TO_CLICK) { return; } if (multiplayerData.win == MultiplayerData.wins.PLAYER1 && (type == StandaloneInputManager.types.P1_LEFT || type == StandaloneInputManager.types.P1_RIGHT)) { Clicked(); } else if (multiplayerData.win == MultiplayerData.wins.PLAYER2 && (type == StandaloneInputManager.types.P2_LEFT || type == StandaloneInputManager.types.P2_RIGHT)) { Clicked(); } }
void OnStandaloneKeyDown(StandaloneInputManager.types type) { if (!mainMenu.ready) { return; } switch (type) { case StandaloneInputManager.types.P1_LEFT: case StandaloneInputManager.types.P1_RIGHT: if (!p1) { Invoke("StartSound", 0.1f); } p1 = true; p1_confirm.SetActive(false); p1_done.SetActive(true); break; case StandaloneInputManager.types.P2_LEFT: case StandaloneInputManager.types.P2_RIGHT: if (!p2) { Invoke("StartSound", 0.1f); } p2_confirm.SetActive(false); p2_done.SetActive(true); p2 = true; break; } if (done) { return; } if (p1 && p2) { GetComponent <MainMenu>().OnReset(); Data.Instance.triviaData.RefreshAll(); done = true; GetComponent <MainMenu>().LoadScreen(1, true); } }
public void Init(StandaloneInputManager.types p1, StandaloneInputManager.types p2) { Reset(); bool p1Active = false; bool p2Active = false; if (type == types.LEFT) { if (p1 == StandaloneInputManager.types.P1_LEFT) { p1Active = true; } if (p2 == StandaloneInputManager.types.P2_LEFT) { p2Active = true; } } else { if (p1 == StandaloneInputManager.types.P1_RIGHT) { p1Active = true; } if (p2 == StandaloneInputManager.types.P2_RIGHT) { p2Active = true; } } if (p1Active && p2Active) { empateImage.SetActive(true); } else if (p1Active) { player1.SetActive(true); } else if (p2Active) { player2.SetActive(true); } }
public override void OnStandaloneKeyDown(StandaloneInputManager.types type) { if (!CanInteract()) { return; } if (!player1_timeOver && (type == StandaloneInputManager.types.NONE || (!player1_done && type == StandaloneInputManager.types.P1_LEFT || type == StandaloneInputManager.types.P1_RIGHT) ) ) { ready1.SetActive(true); timerManager_p1.SetState(false); timerManager_p1.ShowReady(true); player1_result = type; player1_done = true; } if (!player2_timeOver && (type == StandaloneInputManager.types.NONE || (!player2_done && type == StandaloneInputManager.types.P2_LEFT || type == StandaloneInputManager.types.P2_RIGHT) ) ) { ready2.SetActive(true); timerManager_p2.SetState(false); timerManager_p2.ShowReady(true); player2_result = type; player2_done = true; } CheckResult(); }
public virtual void OnStandaloneKeyDown(StandaloneInputManager.types type) { }
public override void OnStandaloneKeyDown(StandaloneInputManager.types type) { LoadScreen(0, false); }
void CheckResult() { if (isDone) { return; } if ((player1_done || player1_timeOver) && (player2_done || player2_timeOver)) { isTimerOn = false; timer = 0; standaloneFeedbackButton1.Init(player1_result, player2_result); standaloneFeedbackButton2.Init(player1_result, player2_result); isDone = true; pairButton.SetBothButtonsReady(); float timer1 = timerManager_p1.GetResult(); int score1; if (player1_timeOver) { score1 = 0; } else if (pairButton.button1.win && player1_result == StandaloneInputManager.types.P1_LEFT || pairButton.button2.win && player1_result == StandaloneInputManager.types.P1_RIGHT) { score1 = (int)(timer1 * 100); } else { score1 = 0; } float timer2 = timerManager_p2.GetResult(); int score2; if (player2_timeOver) { score2 = 0; } else if (pairButton.button1.win && player2_result == StandaloneInputManager.types.P2_LEFT || pairButton.button2.win && player2_result == StandaloneInputManager.types.P2_RIGHT) { score2 = (int)(timer2 * 100); } else { score2 = 0; } int win1 = 0; int win2 = 0; if (!player1_timeOver) { if (score1 > 0) { timerManager_p1.AddTime(Data.Instance.settings.timeWin); } else { timerManager_p1.AddTime(Data.Instance.settings.timeLose); } } if (!player2_timeOver) { if (score2 > 0) { timerManager_p2.AddTime(Data.Instance.settings.timeWin); } else { timerManager_p2.AddTime(Data.Instance.settings.timeLose); } } if (score1 > 0 || score2 > 0) { Events.OnSoundFX("correct"); } if (score1 == score2) { if (score1 > 0 && score2 > 0) { win1 = 1; win2 = 1; } else { //pierden los 2: Events.OnSoundFX("wrong"); } } else if (score1 > 0 && score1 > score2) { win1 = 2; if (score2 > 0) { win2 = 1; } } else if (score2 > 0 && score2 > score1) { if (score1 > 0) { win1 = 1; } win2 = 2; } if (!player1_timeOver) { multiplayerData.score_player_1 += score1; resultsPlayer1.Init(win1, score1, timer1); } if (!player2_timeOver) { multiplayerData.score_player_2 += score2; resultsPlayer2.Init(win2, score2, timer2); } SetScores(); StartCoroutine(NextDelayeds()); player1_result = StandaloneInputManager.types.NONE; player2_result = StandaloneInputManager.types.NONE; } }