public static bool operator <(Cost c1, Cost c2) { if (c2 == null) { return(false); } if (c1 == null) { if (c2.CostType == CostTypes.Mana) { if ((c2 as Mana).count == 0) { return(false); } } return(true); } Cost right = c2.Clone(); ManaTypes dominant = right.GetDominantMana(); Cost left = c1.Clone(); left.OrderFirst(dominant); right.OrderFirst(dominant); Cost result = right.Pay(ref left); return(result == null || result == CostTypes.Tap ? false : true); }
public override void OrderFirst(ManaTypes mt) { List <Cost> manas = new List <Cost> (); List <Cost> others = new List <Cost> (); foreach (Cost c in CostList) { if (c is Mana) { manas.Add(c); } else { others.Add(c); } } CostList = manas.OrderBy(m => (m as Mana).TypeOfMana).Concat(others).ToList(); }
public static void CreateMana(Nodes.Node n, ManaTypes type) { GameObject go = Instantiate(Defines.self.manaPrefab); go.transform.position = n.pos; go.transform.localEulerAngles = new Vector3(0, 0, 0); Mana m = new Mana(); m.go = go; m.type = type; xa.uIds++; m.uId = xa.uIds; n.mana = m; m.node = n; manas.Add(m); }
// Restores the given amount of mana to the provided mana type public void RestoreMana(ManaTypes type, float amount) { if (type == ManaTypes.MANA_FORWARD) { manaForward += amount; } if (type == ManaTypes.MANA_BACKWARDS) { manaBackwards += amount; } if (type == ManaTypes.MANA_RIGHT) { manaRight += amount; } if (type == ManaTypes.MANA_LEFT) { manaLeft += amount; } }
public Mana(int x) : base(CostTypes.Mana) { count = x; TypeOfMana = ManaTypes.Colorless; }
public Mana(int x, ManaTypes type) : base(CostTypes.Mana) { count = x; TypeOfMana = type; }
public Mana(ManaTypes type) : base(CostTypes.Mana) { TypeOfMana = type; count = 1; }
public Mana() : base(CostTypes.Mana) { TypeOfMana = ManaTypes.Colorless; count = 0; }
public virtual void OrderFirst(ManaTypes mt) { }