Exemple #1
0
    void Awake()
    {
        syncController   = GameObject.FindObjectOfType <SyncController>();
        spellsController = GameObject.FindObjectOfType <SpellsController>();

        timeToStart   = Time.time + 4;
        initialCanvas = transform.Find("InitialCanvas").gameObject;
        initialText   = initialCanvas.transform.Find("InitialText").GetComponent <Text>();
        mapNameText   = initialCanvas.transform.Find("MapNameText").GetComponent <Text>();
        initialCanvas.SetActive(true);
        gameStarted = false;

        playerInfoText = GameObject.Find("InfoText").GetComponent <Text>();
        healthbarImage = GameObject.Find("HealthbarImage").GetComponent <Image>();

        spellsListCanvas = GameObject.Find("SpellsListCanvas").transform;
        endCanvas        = transform.Find("EndCanvas").gameObject;
        winnerNameText   = endCanvas.transform.Find("Panel/WinnerCanvas/WinnerNameText").GetComponent <Text>();
        endCanvas.SetActive(false);

        spellIcons = new List <GameSpellIcon>();
        foreach (SpellItem spellItem in syncController.GetSpellsSelected())
        {
            GameSpellIcon spellIcon = Instantiate(spellIconPrefab).GetComponent <GameSpellIcon>();
            spellIcon.SetData(spellItem);
            spellIcon.transform.SetParent(spellsListCanvas);

            spellIcons.Add(spellIcon);
        }
    }
Exemple #2
0
    public void UseSpell(string spellName)
    {
        GameSpellIcon sIcon = spellIcons.Find(x => x.spellName == spellName);

        sIcon.UseSpell();
    }