Example #1
0
    public Transform GetAttachmentTargetTransform(EAttachmentTarget target)
    {
        Transform t = transform;

        attachmentTargetLookup.TryGetValue(target, out t);
        return(t);
    }
Example #2
0
    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();
        }
    }
Example #3
0
    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);
        }
    }
Example #4
0
    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);
    }