Ejemplo n.º 1
0
    //return an int tracker, allocate the number to caller so that caller can remove this buff
    public int SetBuffUI(BuffTypeUI bType)
    {
        //grab data
        BuffDataUI data = null;

        for (int i = 0; i < buffData.Length; i++)
        {
            BuffDataUI d = buffData[i];
            if (d.type == bType)
            {
                data = d;
                break;
            }
        }
        if (data == null)
        {
            Debug.Log("The buff type is not relating to a buff data.");
            return(-1);
        }
        //grab an empty place
        StateBuffUI newBuffPrompt = Instantiate(buffPromptPrefab, this.transform);

        newBuffPrompt.Set(data.sprite, data.text);
        //save the prompt reference in back-end
        for (int i = 0; i < currentBuffs.Count; i++)
        {
            if (currentBuffs[i] == null)
            {
                currentBuffs[i] = newBuffPrompt;
                return(i);
            }
        }
        currentBuffs.Add(newBuffPrompt);
        return(currentBuffs.Count - 1);
    }
Ejemplo n.º 2
0
 public void AddBuff(StatusBuff buff, BuffTypeUI uiType)
 {
     buff.uiPromptTrackingIndex = uiController.SetBuffUI(uiType);
     buff.StartBuff();
     buffCollection.Add(buff);
 }