internal static void RemoveBuffCallback(object[] data) { CardObjectBehaviour cob = CardObjectBehaviour.GetCOB((int)data[0]); BuffBehaviour bob = BuffBehaviour.GetBOB((int)data[1]); cob.RemoveBuff(bob.gameObject); }
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); }
private static void AddBuff(BuffBehaviour bob) { try { AllBuffs.Add(bob.Guid, bob); } catch (ArgumentException e) { throw new Exception(" --- Catched --- : " + e.Message); } }
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); }
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); } }
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)); } }
public void AddBuff(BuffBehaviour.BuffType _type, float time = -1) { AddBuff(BuffBehaviour.GetBuff(_type, time)); }
public void RemoveBuff(BuffBehaviour _buffBehaviour) { buffList.Remove(_buffBehaviour); buffTypeList.Remove(_buffBehaviour.buffType); }