Exemplo n.º 1
0
    public override bool Attach(GameObject hook, GameObject target)
    {
        if (hook == null || target == null)
        {
            return(false);
        }

        m_enabled = true;

        m_hook               = hook;
        m_target             = target;
        m_targetRigidbody    = m_target.GetComponent <Rigidbody2D>();
        m_targetInteractable = m_target.GetComponent <BaseInteractable>();

        Vector2 pos       = transform.position;
        Vector2 targetPos = m_target.transform.position;

        m_oldPos = targetPos;

        if (m_targetInteractable != null)
        {
            m_targetInteractable.StartInteract(m_hookBehaviour);
        }

        return(true);
    }