Beispiel #1
0
    void CatchMonster(Enemy en)
    {
        if (!relasingMonster)
        {
            Monster = en;
            //cEnemy.GetComponent<RelativeJoint2D>().enabled = true;
            //cEnemy.GetComponent<RelativeJoint2D>().linearOffset = new Vector2(0.2f, 0.25f);
            //cEnemy.GetComponent<RelativeJoint2D>().connectedBody = GetComponent<Rigidbody2D>();
            anim.SetBool("onMonster", true);
            var rb = GetComponent<Rigidbody2D>();
            //rb.position = pos;
            //rb.position = new Vector2(Monster.GetComponent<Rigidbody2D>().position.x + Monster.transform.Find("Saddle").transform.position.x, Monster.GetComponent<Rigidbody2D>().position.y + Monster.transform.Find("Saddle").transform.position.y);// .GetComponent<Rigidbody2D>().position;

            //monster.playerCheck.GetComponent<CircleCollider2D>().OverlapPoint()
            Monster.SetConnectedBody(GetComponent<Rigidbody2D>());
            Vector2 pos = Monster.SetControll(true, direction);
            Monster.EnableRelativeJoint2D(true);
        }
    }