示例#1
0
    public void AddWarscrollOption(Warscroll warscroll, Transform parent, Type type)
    {
        GameObject go     = _optionsPool.GetGameObject();
        Option     option = go.GetComponent <Option>();

        option._warscroll = warscroll;
        option.UpdateOption(type);

        go.name = warscroll._name;
        go.transform.SetParent(parent);
        go.transform.localScale = new Vector3(1, 1, 1);

        _options.Add(go);
    }
示例#2
0
    public void AddElement(Warscroll warscroll, Type type)
    {
        Transform  parent;
        GameObject go;
        Item       item;

        if (type == Type.General)
        {
            go     = _generalPool.GetGameObject();
            parent = _generalPanel;
            DataManager.Instance._currentGeneral = new Warscroll[] { warscroll };
        }
        else
        {
            go     = _troopsPool.GetGameObject();
            parent = _troopsPanel;
            DataManager.Instance._currentWarscrolls.Add(warscroll);
        }

        go.transform.SetParent(parent);
        go.transform.localScale = new Vector3(1, 1, 1);
        go.name = warscroll._name;

        item            = go.GetComponent <Item>();
        item._warscroll = warscroll;
        item.UpdateItem();

        _warscrollsGO.Add(go);

        if (type == Type.General)
        {
            _generalPanel.GetChild(0).GetComponentInChildren <Button>().interactable = false;
            _generalTemplate.SetActive(false);
        }
        else
        {
            _troopsTemplate.SetActive(false);
        }

        _usedWarscrolls.Add(warscroll);

        UpdateElementsPositions();
        UpdateTotalRenown();

        Debug.Log("Add warscroll: " + warscroll._name);
    }