public bool Attach(IActorAttachment attachment, object context, ActorAttachArgs args) { DebugUtility.AssertFormat(attachment.owner == null, "The owner of attachment ({0}) must be null (Actor : [{1}])", attachment.name, name); if (FindJoint(attachment.jointName, true, out var info)) { info.attachments.Add(attachment); attachment.OnAttach(this, context, args); return(true); } return(false); }
public bool Detach(IActorAttachment attachment, object context) { DebugUtility.AssertFormat(attachment.owner == this, "The owner of attachment ({0}) must be this Actor : [{1}]", attachment.name, name); attachment.OnDetach(context); if (FindJoint(attachment.jointName, false, out var info)) { info.attachments.Remove(attachment); return(true); } DebugUtility.LogErrorTrace("Missing joint : [{0}], Actor : [{1}], Attachment : {2}", attachment.jointName, name, attachment.name); return(false); }
public bool Attach(IActorAttachment attachment, object context) { return(Attach(attachment, context, ActorAttachArgs.Default)); }
public bool Attach(IActorAttachment attachment) { return(Attach(attachment, null, ActorAttachArgs.Default)); }