Пример #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        //when hit by a capsule, say this
        if (other.GetComponent <CapsuleController>())
        {
            egg = other.GetComponent <CapsuleController>();

            //THIS IS WHERE THE ITEMS ARE DISSAPEARING WHYYYYYYYYYY
            //FUTURE SELF FIGURE IT OUT NERDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
            //activaate anims

            anim.SetTrigger("Grab");
            //snap egg
            egg.transform.position = holdingPoint.transform.position;

            egg.transform.rotation = holdingPoint.transform.rotation;
            //freeze egg

            egg.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll;
            egg.Unload(gameObject.GetComponent <UnPackager>());
            StartCoroutine(ReturnEgg());
        }
    }