public Transform GetAttachmentTargetTransform(EAttachmentTarget target) { Transform t = transform; attachmentTargetLookup.TryGetValue(target, out t); return(t); }
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 RemoveAttachmentFromTarget(EAttachmentTarget target) { AttachmentBase attachment = null; if (attachmentTargetContents.TryGetValue(target, out attachment)) { attachment.OnRemoveFromKoboto(this); attachment.Remove(); EAttachmentType type = attachment.attachmentType; currentAttachments.Remove(type); attachmentTargetContents.Remove(target); SetupCollider(); Debug.Log("Removeing attachment: " + type + " from " + target); } }
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); }