Untitled
unknown
plain_text
a year ago
1.5 kB
10
Indexable
void DashAttack() { if(distance < 10f && distance > 0.1) { Debug.Log(distance); RaycastHit2D LOSray = Physics2D.Raycast(transform.position, Player.transform.position - transform.position,distance, MyMask); RaycastHit2D Pushray = Physics2D.Raycast(transform.position, Player.transform.position - transform.position,distance, NotPush); Debug.Log("Raying"); if(LOSray.collider != null) { Debug.Log("notNull"); hasLineOfSight = LOSray.collider.CompareTag("Player"); Debug.Log($"Raycast hit unNull: {LOSray.collider.name}"); } if(hasLineOfSight) { Debug.DrawRay(transform.position, Player.transform.position - transform.position, Color.green); rb.velocity = new Vector2(direction.x, direction.y).normalized * dashForce; float rot = Mathf.Atan2(-direction.y, -direction.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(0, 0, rot); //transform.position = Vector2.MoveTowards(transform.position, Player.transform.position, speed *Time.deltaTime); Debug.Log($"RaycastSight hit: {LOSray.collider.name}"); Debug.Log("lineOfsigh"); if(Pushray.collider != null) { Debug.Log("Found: NotPush"); } } } }
Editor is loading...
Leave a Comment