/// <summary> /// Determine if AI use is PickUp /// </summary> public void UsePickUpIA() { if (m_pickUp) { GameObject ball = GameManager.GetBallInfo(); float direction = ball.GetComponent <Rigidbody2D>().velocity.y; PICKUPTYPE acceptType = direction / transform.position.y > 0 ? PICKUPTYPE.LOW : PICKUPTYPE.BOOST; Vector2 ballPos = ball.transform.position; Vector2 pos = transform.position; if (m_pickUp.GetPickUpType() == acceptType && InDistOfUseAI(acceptType, Mathf.Abs(pos.y - ballPos.y))) { UsePickUp(); } } }