private void OnTriggerStay(Collider other) { if (other.tag.Equals(SV.tag_Ball)) { BallController ball_controller = other.gameObject.GetComponent <BallController>(); float dis = fan_ground.GetDistanceToPoint(other.transform.position); force_Vector = force_Direction * (power / dis); // Debug.Log("force_Vector : " + force_Vector ); ball_controller.AddForce(force_Vector); } }
//Work when touch up void UpTouch() { if (speed < 10) { BallController.SetPosition(ballSpawnArea.transform.position); } else if (speed > 30) { speed = 30; BallController.SetActiveCollider(true); BallController.AddForce(-direction * speed); LevelManager.instance.CreateBall(); } else { BallController.SetActiveCollider(true); BallController.AddForce(-direction * speed); LevelManager.instance.CreateBall(); } PredictionManager.instance.DeletePredict(); touchActive = false; }
public void OnPointerDown(PointerEventData eventData) { ball.AddForce(); }