Example #1
0
    void Start()
    {
        // Настройка пула
        PoolManager.Parents.Add(PoolManager.Type.UI, UiPoolParent);

        GameStatesManager.EnableState(MainMenuState);
    }
Example #2
0
    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();
    }
Example #3
0
    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();
    }
Example #4
0
    // Ожидание нажатия клавиши SPACE для входа в игру
    private IEnumerator StartGame()
    {
        yield return(new WaitUntil(() => Input.GetKeyDown(KeyCode.Space)));

        GameStatesManager.EnableState(DI.Resolve <GameplayState>());
    }