Пример #1
0
    public void Catch(SanjoHandController _handController)
    {
        mainTransform.SetParent(_handController.handMainTransform);
        _handController.OnCatch(owner);

        mainRigidbody.isKinematic     = true;
        mainRigidbody.velocity        = Vector2.zero;
        mainRigidbody.angularVelocity = 0;
        mainTransform.localPosition   = new Vector3(0.75f, 0, 0);
        mainTransform.localRotation   = Quaternion.identity;
    }
Пример #2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.collider.tag.CompareTo(owner.tag) == 0)
        {
            return;
        }

        if ((Time.time - lastThrowTime) > 0.6f)
        {
            Transform theParent = collision.gameObject.transform.parent;

            if (theParent != null)
            {
                SanjoHandController theHandController = theParent.GetComponentInParent <SanjoHandController>();

                if (theHandController != null)
                {
                    Catch(theHandController);
                }
            }
        }
    }