private void OnInputStart(ControlScheme cs) { // Slot already with this cs for (int i = 0; i < 2; ++i) { if ((ControlScheme)InputExt.GetPlayerScheme(i) == cs) { InputExt.SetPlayerControlScheme(i, ControlScheme.AI); //SoundManager.PlayClickSound(); player_change_sound.Play(); UpdateControlsText(i); return; } } // Assign cs to empty slot for (int i = 0; i < 2; ++i) { if ((ControlScheme)InputExt.GetPlayerScheme(i) == ControlScheme.AI) { InputExt.SetPlayerControlScheme(i, cs); //SoundManager.PlayClickSound(); player_change_sound.Play(); UpdateControlsText(i); return; } } }
// PUBLIC ACCESSORS public bool ValidControlChoices() { ControlScheme cs0 = (ControlScheme)InputExt.GetPlayerScheme(0); ControlScheme cs1 = (ControlScheme)InputExt.GetPlayerScheme(1); return((cs0 != ControlScheme.None && cs1 != ControlScheme.None) && (cs0 != cs1 || cs0 == ControlScheme.AI)); }
private void UpdateControlsText(int player_id) { if ((ControlScheme)InputExt.GetPlayerScheme(player_id) == ControlScheme.AI) { controls_text[player_id].text = controls_text_initial; } else { controls_text[player_id].text = InputExt.GetPlayerScheme(player_id).ToString(); } }
private IEnumerator OnTagRoutine(Chara winner) { HideCourt(); // Wait for end of turn change if happened on same frame as turn change while (State == MatchState.TurnChange) { yield return(null); } // State and score State = MatchState.Tagged; ++scores[winner.PlayerID]; yield return(new WaitForSeconds(1f)); // Show UI match_ui.ShowTagScreen(winner, scores); charas[0].ShowReplay(); charas[1].ShowReplay(); // Wait if ((ControlScheme)InputExt.GetPlayerScheme(winner.PlayerID) == ControlScheme.AI) { yield return(new WaitForSeconds(2.5f)); } else { while (!InputExt.GetKeyDown(winner.PlayerID, Control.Action)) { yield return(null); } } // Hide UI match_ui.HideTagScreen(); // Reset if (on_reset != null) { on_reset(); } // Next turn StartNextTurn(); }
// PUBLIC MODIFIERS public void Initialize(int id, Color color) { this.PlayerID = id; this.PlayerColor = color; waypoints = CourtManager.court.waypoints; start_pos = CourtManager.court.spawn_positions[PlayerID].position; Setup(); if ((ControlScheme)InputExt.GetPlayerScheme(id) == ControlScheme.AI) { StartCoroutine(UpdateAI()); } else { StartCoroutine(UpdateHuman()); } GameManager.Instance.on_reset += Setup; }