Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (!Stuck)
        {
            int          Layer = 768;
            RaycastHit2D hit   = Physics2D.Raycast(transform.position, transform.up, Mathf.Infinity, Layer);
            Debug.DrawRay(transform.position, transform.up);
            Debug.Log(hit.collider.tag);
            if (hit.collider != null && hit.distance <= .5f && (hit.collider.tag == "Wall" || hit.collider.tag == "Player" || hit.collider.tag == "MovingWall"))
            {
                Stuck = true;

                if (hit.collider.tag == "Player" || hit.collider.tag == "MovingWall")
                {
                    transform.SetParent(hit.collider.transform, true);
                }
                transform.position = hit.point;
                PS.CanDirectOff();
                RB.velocity    = Vector2.zero;
                RB.isKinematic = true;
                if (IsFireArrow)
                {
                    StartCoroutine(BurnDamage());
                }
                Debug.Log(transform.eulerAngles + " local" + transform.localEulerAngles);
            }
        }
    }