public override void OnStart(Action callback) { gameObject.SetActive(true); guiSound = new GuiSound(); BackToMainMenuButton.onClick.AddListener(() => { AudioManager.Instance.PlaySound(guiSound); GameStatesManager.EnableState(DI.Resolve <MainMenuState>()); }); callback?.Invoke(); }
public override void OnStart(Action callback) { guiSound = new GuiSound(); playerShips = Resources.LoadAll <PlayerShip>(""); if (selectedIndex == 0) { SelectedShip = playerShips[selectedIndex]; } LeftButton.onClick.AddListener(() => { AudioManager.Instance.PlaySound(guiSound); if (selectedIndex == 0) { selectedIndex = playerShips.Length - 1; } else { selectedIndex--; } SelectedShip = playerShips[selectedIndex]; }); RightButton.onClick.AddListener(() => { AudioManager.Instance.PlaySound(guiSound); if (selectedIndex == playerShips.Length - 1) { selectedIndex = 0; } else { selectedIndex++; } SelectedShip = playerShips[selectedIndex]; }); StartButton.onClick.AddListener(() => { AudioManager.Instance.PlaySound(guiSound); DI.Resolve <LoadLevelState>().SetLevel(0); DI.Resolve <LoadLevelState>().SetPlayerShip(selectedShip); GameStatesManager.EnableState(DI.Resolve <LoadLevelState>()); }); gameObject.SetActive(true); callback?.Invoke(); }