public void RemoveAttachmentOfType(EAttachmentType type) { AttachmentBase attachment = null; if (currentAttachments.TryGetValue(type, out attachment)) { attachment.Remove(); EAttachmentTarget target = Attachments.AttachmentTarget(type); currentAttachments.Remove(type); attachmentTargetContents.Remove(target); SetupCollider(); } }
public void AddAttachment(EAttachmentType type) { AttachmentBase attachment = Attachments.CreateNewAttachment(type); EAttachmentTarget target = Attachments.AttachmentTarget(type); RemoveAttachmentFromTarget(target); Transform attachToTransform = GetAttachmentTargetTransform(target); attachment.transform.SetParent(attachToTransform, false); attachmentTargetContents[target] = attachment; currentAttachments[attachment.attachmentType] = attachment; Debug.Log("Adding attachment: " + type + " to " + target); SetupCollider(); attachment.OnAttachToKoboto(this); }