Beispiel #1
0
    //////////////////////////////////////////
    /// RemoveEffect()
    /// Remove incoming effect on this model,
    /// if it exists.
    //////////////////////////////////////////
    public void RemoveEffect(RemovedEffectData i_removalData)
    {
        // first get all effects on this model
        List <Effect> listEffects = GetAllEffects();

        // this new dictionary will contain the non-removed effects
        Dictionary <string, Effect> dictNewEffects = new Dictionary <string, Effect>();

        // loop through each effect and see if it should be removed...
        // if it shouldn't, add it to the new list
        foreach (Effect effect in listEffects)
        {
            bool bShouldRemove = effect.ShouldRemove(i_removalData);
            if (bShouldRemove == false)
            {
                dictNewEffects.Add(effect.GetID(), effect);
            }
            else
            {
                //Debug.Log( "Effect Removed: " + effect.GetID() );
            }
        }

        // set our current effects to the new list, which will have the removed effects eliminated from it
        SetProperty("Effects", dictNewEffects);
    }
Beispiel #2
0
    //////////////////////////////////////////
    /// ShouldRemove()
    /// Given the incoming removal data, will
    /// return if this effect should be 
    /// removed.
    //////////////////////////////////////////
    public bool ShouldRemove( RemovedEffectData i_removalData ) {
        // if the removal data has an effect ID that matches this effect's ID, it should be removed
        if ( i_removalData.EffectID == m_data.ID )
            return true;

        // next, if the removal effect removes by category, see if there are any matching categories
        foreach ( EffectCategories category in i_removalData.Categories ) {
            if ( m_data.Categories.Contains( category ) )
                return true;
        }

        // the effect should not be removed if we got to here
        return false;
    }
Beispiel #3
0
    //////////////////////////////////////////
    /// ShouldRemove()
    /// Given the incoming removal data, will
    /// return if this effect should be
    /// removed.
    //////////////////////////////////////////
    public bool ShouldRemove(RemovedEffectData i_removalData)
    {
        // if the removal data has an effect ID that matches this effect's ID, it should be removed
        if (i_removalData.EffectID == m_data.ID)
        {
            return(true);
        }

        // next, if the removal effect removes by category, see if there are any matching categories
        foreach (EffectCategories category in i_removalData.Categories)
        {
            if (m_data.Categories.Contains(category))
            {
                return(true);
            }
        }

        // the effect should not be removed if we got to here
        return(false);
    }
Beispiel #4
0
    //////////////////////////////////////////
    /// RemoveEffect()
    /// Remove incoming effect on this model,
    /// if it exists.
    //////////////////////////////////////////
    public void RemoveEffect( RemovedEffectData i_removalData ) {
        // first get all effects on this model
        List<Effect> listEffects = GetAllEffects();

        // this new dictionary will contain the non-removed effects
        Dictionary<string, Effect> dictNewEffects = new Dictionary<string, Effect>();

        // loop through each effect and see if it should be removed...
        // if it shouldn't, add it to the new list
        foreach ( Effect effect in listEffects ) {
            bool bShouldRemove = effect.ShouldRemove( i_removalData );
            if ( bShouldRemove == false )
                dictNewEffects.Add( effect.GetID(), effect );
            else {
                //Debug.Log( "Effect Removed: " + effect.GetID() );
            }
        }

        // set our current effects to the new list, which will have the removed effects eliminated from it
        SetProperty( "Effects", dictNewEffects );
    }