Пример #1
0
    internal static void RemoveBuffCallback(object[] data)
    {
        CardObjectBehaviour cob = CardObjectBehaviour.GetCOB((int)data[0]);
        BuffBehaviour       bob = BuffBehaviour.GetBOB((int)data[1]);

        cob.RemoveBuff(bob.gameObject);
    }
Пример #2
0
    internal static void AddBuffCallback(object[] data)
    {
        int    cardGuid = (int)data[0];
        int    buffGuid = (int)data[1];
        string iconPath = (string)data[2];

        BuffBehaviour.Create(CardObjectBehaviour.GetCOB(cardGuid), buffGuid, iconPath);
    }
Пример #3
0
 private static void AddBuff(BuffBehaviour bob)
 {
     try
     {
         AllBuffs.Add(bob.Guid, bob);
     }
     catch (ArgumentException e)
     {
         throw new Exception(" --- Catched --- : " + e.Message);
     }
 }
Пример #4
0
    public static GameObject Create(CardObjectBehaviour cob, int guid, string path)
    {
        GameObject    bo = Instantiate(Resources.Load("prefabs/Buff")) as GameObject;
        BuffBehaviour bb = bo.GetComponent <BuffBehaviour>();

        bb.Image.sprite = Resources.Load <Sprite>("sprites/buffs/" + path);
        bb.Guid         = guid;
        bo.transform.SetParent(cob.gameObject.transform);
        cob.AddBuff(bo);
        AddBuff(bb);
        return(bo);
    }
Пример #5
0
    internal static BuffBehaviour GetBOB(int guid)
    {
        BuffBehaviour ret = null;

        if (AllBuffs.TryGetValue(guid, out ret))
        {
            return(ret);
        }
        else
        {
            Debug.LogError(Environment.StackTrace);
            throw new Exception("No such buff in the game, id: " + guid);
        }
    }
Пример #6
0
    public void AddBuff(BuffBehaviour _buffBehaviour)
    {
        if (_buffBehaviour == null)
        {
            return;
        }
        BuffBehaviour b = null;

        if (buffList.Count > 0)
        {
            int index = buffList.FindIndex(buff => buff.buffType == _buffBehaviour.buffType);
            if (index >= 0)
            {
                b = buffList[index];
            }
        }
        if (b == null)
        {
            buffList.Add(_buffBehaviour);
            buffTypeList.Add(_buffBehaviour.buffType);
            //_buffBehaviour.AddBuffAction(this);
            StartCoroutine(_buffBehaviour.BuffCoroutine(this));
        }
    }
Пример #7
0
 public void AddBuff(BuffBehaviour.BuffType _type, float time = -1)
 {
     AddBuff(BuffBehaviour.GetBuff(_type, time));
 }
Пример #8
0
 public void RemoveBuff(BuffBehaviour _buffBehaviour)
 {
     buffList.Remove(_buffBehaviour);
     buffTypeList.Remove(_buffBehaviour.buffType);
 }