示例#1
0
    private void OnEndTurnCallback()
    {
        if (ActiveStepPhase == PlayerStepPhase.Select && figureContainer.SelectedFigure != null)
        {
            ++activePlayerIndex;
            if (activePlayerIndex >= startData.playerNames.Length)
            {
                activePlayerIndex = 0;
            }

            ActiveStepPhase = PlayerStepPhase.Place;
        }
    }
示例#2
0
    private void OnDeskTap(DeskEllement ellement)
    {
        if (GameManager.Instance.ActiveStepPhase == PlayerStepPhase.Place)
        {
            if (figureContainer.SelectedFigure != null)
            {
                var figure = figureContainer.SelectedFigure;
                ellement.AttachFigure(figure);
                figure.Attach();

                GameEvents.Instance.OnAttachFigure(ellement, figure);
                ActiveStepPhase = PlayerStepPhase.Select;
            }
        }
    }
示例#3
0
    private void OnPlayerPhaseChanged(string a_playerName, PlayerStepPhase a_phase)
    {
        PlayerName.text = a_playerName + "\n";
        switch (a_phase)
        {
        case PlayerStepPhase.Place:
            PlayerName.text        += "Please place selected figure";
            EndTurnBtn.interactable = false;
            break;

        case PlayerStepPhase.Select:
            PlayerName.text        += "Please select figure for opponent";
            EndTurnBtn.interactable = false;
            break;
        }
    }
示例#4
0
    // Start is called before the first frame update
    void Start()
    {
        startData = GlobalDataManager.Instance.activeLevelSettings;
        if (desk != null)
        {
            desk.CreateMap(startData.level.deskSize);
            figureContainer.CreateFigures(startData.level.colorPairs, GetFigure(), GetMaterials());
        }

        ActiveStepPhase = PlayerStepPhase.Select;

        GameEvents.Instance.OnDeskEllementTap += OnDeskTap;
        GameEvents.Instance.OnCollectLine     += OnLineCollected;
        GameEvents.Instance.OnResetGame       += OnResetGame;
        GameEvents.Instance.OnTurnEnd         += OnEndTurnCallback;
    }