dd
New Member
Posts: 5
|
Post by dd on Aug 28, 2018 19:34:16 GMT
Hello does anyone know how to remove an aspect from a card?
action.tability.card.AddAspect<TriggeredAbilities>() = null;
or action.tability.card.RemoveAspect<TriggeredAbilities>();
basically i am trying to remove the TriggeredAbilities after a certain count hits within triggeredability...gonna be weird cause the aspect is on the abilities and not the ability but should be able to make due...
Is this something that would work to remove the aspect?
public T RemoveAspect<T>(T aspect, string key = null) where T : IAspect
{
key = key ?? typeof(T).Name;
aspects.Remove(key);
aspect.container = this;
return aspect;
}
|
|
dd
New Member
Posts: 5
|
Post by dd on Aug 29, 2018 4:40:53 GMT
can confirm the code works
|
|
|
Post by Admin on Aug 29, 2018 13:24:44 GMT
Looks like you got something working, but as one small note, I would recommend setting the aspect.container to "null" instead of "this". The idea is that an aspect's container, and a container's aspects would always be synched. So removing an aspect from a container should cause the aspect not to have a container either.
|
|
dd
New Member
Posts: 5
|
Post by dd on Aug 29, 2018 16:55:51 GMT
thanks for the advice! done and ya no issues after the change too
|
|