public void AddElementOnPlayer(ElementEffectIn.ElementType elementType, GameObject elementEffect) { if (elementEffect != null) { elementsOnPlayer.Add(elementType, elementEffect); } }
public void CleanElement(ElementEffectIn.ElementType element) { GameObject elementRemove; // Get the element to clean/remove, make it disappear and remove from the game elementsOnPlayer.TryGetValue(element, out elementRemove); elementEffect.RemoveEffect(element, elementRemove); elementsOnPlayer.Remove(element); }
void CreateEffect(ElementEffectIn.ElementType element) { GameObject elementEffect = null; //If the player already have an effect on him, remove it //if (previousEffect != null) //{ // Destroy(previousEffect, startEffectDelay); //} Debug.Log("Picked up " + element); switch (element) { case ElementEffectIn.ElementType.Electricity: elementEffect = this.elementEffect.ElectricityCreate(elementsOnPlayer); break; case ElementEffectIn.ElementType.Fire: elementEffect = this.elementEffect.FireCreate(elementsOnPlayer); break; case ElementEffectIn.ElementType.Water: elementEffect = this.elementEffect.WaterCreate(elementsOnPlayer); break; case ElementEffectIn.ElementType.Wood: elementEffect = this.elementEffect.WoodCreate(elementsOnPlayer); break; case ElementEffectIn.ElementType.Wing: elementEffect = this.elementEffect.WingCreate(elementsOnPlayer); break; case ElementEffectIn.ElementType.Hole: GameObject ground = GameObject.FindGameObjectWithTag("Ground"); this.elementEffect.HoleCreate(elementsOnPlayer, ground); // Should create a hole in the ground break; } //Didn't find any orb with that type of color if (elementEffect == null) { return; } // Save the refference for the next time it will get another effect and cancel the last one previousEffect = elementEffect; elementsOnPlayer.Add(element, elementEffect); }