private void LoadGame(CharacterSelectionManager.Character p1Character, CharacterSelectionManager.Character p2Character) { LevelManager.p1Selected = p1Character; LevelManager.p2Selected = p2Character; SceneManager.LoadScene(2, LoadSceneMode.Additive); currentScene = 2; }
private void Awake() { selectedShip = CharacterSelectionManager.Character.none; currentSelected = firstShip; if (!isPlayer1) { foreach (Animator ship in shipList) { ship.SetTrigger("RIGHT"); } } }
IEnumerator SelectShip(int shipIndex) { float selectClock = 0f; isSelecting = true; if (isPlayer1) { AkSoundEngine.PostEvent("sfx_ui_ok_p1", gameObject); } else { AkSoundEngine.PostEvent("sfx_ui_ok_p2", gameObject); } while (selectClock < cancelTime && !shouldCancel) { selectClock += Time.deltaTime; yield return(null); } if (!shouldCancel) { selectedShip = (CharacterSelectionManager.Character)(shipIndex + 1); if (isPlayer1) { characterSelectionManager.p1SelectedCharacter = selectedShip; } else { characterSelectionManager.p2SelectedCharacter = selectedShip; } } else { foreach (Animator ship in shipList) { if (ship != shipList[currentSelected]) { ship.SetTrigger("IDLE"); } } } isSelecting = false; }
public void TryCancel(InputAction.CallbackContext context) { if (isSelecting || selectedShip != CharacterSelectionManager.Character.none) { shouldCancel = true; foreach (Animator ship in shipList) { if (ship != shipList[currentSelected]) { ship.SetTrigger("IDLE"); } } selectedShip = CharacterSelectionManager.Character.none; if (isPlayer1) { characterSelectionManager.p1SelectedCharacter = selectedShip; } else { characterSelectionManager.p2SelectedCharacter = selectedShip; } } }