Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        AllActionInfo allActionInfoList = JsonUtility.FromJson <AllActionInfo>(jsonFile.text);

        //actionDictionary = actionInfoList.ToDictionary(x => x.actionId, x => x);
        foreach (var actionInfo in allActionInfoList.abilityInfos)
        {
            if (actionInfo.actionId == "Attack")
            {
                GameObject   button       = Instantiate(buttonPrefab, buttonsParent);
                ActionButton actionButton = button.GetComponent <ActionButton>();
                actionButton.Init(actionInfo);
                break;
            }
        }

        foreach (var actionInfo in allActionInfoList.topBattleInfos)
        {
            if (actionInfo.actionId == "back")
            {
                continue;
            }
            GameObject   button       = Instantiate(buttonPrefab, buttonsParent);
            ActionButton actionButton = button.GetComponent <ActionButton>();
            actionButton.Init(actionInfo);
            actionButtonDictionary[actionInfo.actionId] = actionButton;
        }
    }
Exemplo n.º 2
0
    //creates a button for a player to use an action and ass it to the action button list
    private void CreateActionButton(Vector3 position, string buttonName, BattleActions buttonAction, BaseChampion championSelected)
    {
        GameObject   newButtonObject = Instantiate(GameManager._prefabs.actionButtonPrefab, position, Quaternion.identity);
        ActionButton newButton       = newButtonObject.GetComponent <ActionButton>();

        newButton.Init(buttonName, buttonAction, championSelected);
        actionButtons.Add(newButton);
    }
Exemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        AllActionInfo allActionInfoList = JsonUtility.FromJson <AllActionInfo>(jsonFile.text);

        abilityDict = allActionInfoList.abilityInfos.ToDictionary(x => x.actionId, x => x);
        //this might change for each battle
        foreach (var actionInfo in allActionInfoList.abilityInfos)
        {
            if (actionInfo.actionId == "Attack")
            {
                continue;
            }
            GameObject   button       = Instantiate(buttonPrefab, buttonsParent);
            ActionButton actionButton = button.GetComponent <ActionButton>();
            actionButton.Init(actionInfo);
            abilityButtons[actionInfo.actionId] = actionButton;
            button.SetActive(false);
            abilityLevel[actionInfo.actionId] = -1;

            //test
            //if(actionInfo.actionId == "Focus" || actionInfo.actionId == "Tiny Tornado" || actionInfo.actionId == "Heat Breath")
            //{

            //    abilityLevel[actionInfo.actionId] = 0;
            //}

            abilityExp[actionInfo.actionId] = 0;
        }
        foreach (var actionInfo in allActionInfoList.topBattleInfos)
        {
            if (actionInfo.actionId == "back")
            {
                GameObject   button       = Instantiate(buttonPrefab, buttonsParent);
                ActionButton actionButton = button.GetComponent <ActionButton>();
                actionButton.Init(actionInfo);
                abilityButtons[actionInfo.actionId] = actionButton;
            }
        }
    }