public static Element GetElement(Element.Type type, Level level, int slot) { Element element = new Element(type, level, slot); element.currHolder = Holder.Board; if (GetElementPermission(level.Score.Prestige) < element.GetElementTier()) element.Destroy(); if (OnBuild != null) OnBuild(element); return element; }
/// <summary> /// Returns the appropriate Element object based on the two Elements provided to combine. /// the Elements provided will turn to Fizzle types since they should be discarded after /// they are used to create another Element. /// </summary> /// <param name="a_ElementOne"></param> /// <param name="a_ElementTwo"></param> /// <param name="a_level"></param> /// <returns>The resulting element. Fizzle if there is no valid combination.</returns> public static Element GetElement(Element a_ElementOne, Element a_ElementTwo, Level a_level, int slot) { Element.Type TypeA = a_ElementOne.m_Type; Element.Type TypeB = a_ElementTwo.m_Type; if (TypeA > TypeB) { Element.Type temp = TypeB; TypeB = TypeA; TypeA = temp; } a_ElementOne.Destroy(true); a_ElementTwo.Destroy(true); Element element = new Element(Map[(int)TypeA, (int)TypeB], a_level, slot); element.currHolder = Holder.Board; if (GetElementPermission(a_level.Score.Prestige) < element.GetElementTier()) element.Destroy(); if (OnBuild != null) OnBuild(element); return element; }