Vector2 random_point(cleaner_hand hand) { Vector2 bottom = bottom_point(hand); Vector2 offset = new Vector2(Random.Range(-move_delta.x, move_delta.x), Random.Range(0f, move_delta.y)); return(bottom + offset); }
Vector2 bottom_point(cleaner_hand hand, bool farest = false) { var gun_pos = hand.gun_position; bool b = (gun_pos - bottom_left).sqrMagnitude < (gun_pos - bottom_right).sqrMagnitude; if (farest) { b = !b; } return(b ? bottom_left : bottom_right); }
Vector2 direction2indruder(cleaner_hand hand) { var gun_pos = hand.gun_position; return((xf_intruder.position.vec2() - gun_pos).normalized); }