コード例 #1
0
    private void CreateInstanceFromPrefab(GUI_AGameElement prefab, AMove move)
    {
        GUI_AGameElement moveInstance = Instantiate(prefab, _anchor);

        moveInstance.Init(move);
        moveInstance.FinishedMoveEvent.AddEventListener(NewMove);
        _history.Add(moveInstance.gameObject);

        moveInstance.OnBackButtonClickedEvent.AddEventListener(BackButtonClickedEventListener);
    }
コード例 #2
0
    private void BackButtonClickedEventListener(GUI_AGameElement element)
    {
        var obj = _history.Remove(element.gameObject);

        if (obj)
        {
            Destroy(element.gameObject);
        }

        var lastElement = GetLastGUIGameElement();

        if (lastElement != null)
        {
            RestartGame();
            lastElement.EnableBackButton();
        }
        else
        {
            ButtonClickedListener();
        }
    }