Пример #1
0
    public void AddEffect(ElementalType type, int shapeId)
    {
        Debug.Log("Add effect: " + gameObject.tag);
        switch (type)
        {
        case ElementalType.fire:
            FireEffect fireEffect = new FireEffect();

            fireEffect.spellType = ElementalType.fire;
            fireEffect.shapeId   = shapeId;
            fireEffect.monster   = gameObject;

            fireEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(fireEffect);
            break;

        case ElementalType.ice:
            IceEffect iceEffect = new IceEffect();

            iceEffect.spellType = ElementalType.ice;
            iceEffect.shapeId   = shapeId;
            iceEffect.monster   = gameObject;

            iceEffect.InitEffect(10f, 1f, 0.5f, 5f);

            spellEffects.Add(iceEffect);
            break;

        case ElementalType.earth:
            earthEffect earthEffect = new earthEffect();

            earthEffect.spellType = ElementalType.earth;
            earthEffect.shapeId   = shapeId;
            earthEffect.monster   = gameObject;

            earthEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(earthEffect);
            break;

        case ElementalType.death:
            deathEffect deathEffect = new deathEffect();

            deathEffect.spellType = ElementalType.death;
            deathEffect.shapeId   = shapeId;
            deathEffect.monster   = gameObject;

            deathEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(deathEffect);
            break;

        case ElementalType.poison:
            poisonEffect poisonEffect = new poisonEffect();

            poisonEffect.spellType = ElementalType.poison;
            poisonEffect.shapeId   = shapeId;
            poisonEffect.monster   = gameObject;

            poisonEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(poisonEffect);
            break;

        default:
            break;
        }
    }