private void kickInRandomDirection(GroupSoccerAnimation other) { var direction = Random.Range(0, 2); var method = other.GetType().GetMethod(kickDirections[direction]); method.Invoke(other, null); }
private void OnTriggerEnter(Collider other) { if (other.GetComponent <GroupSoccerAnimation>() != null) { currentPersonWithBall = other.GetComponent <GroupSoccerAnimation>(); other.GetComponent <CapsuleCollider>().enabled = false; kickInRandomDirection(currentPersonWithBall); } else if (other.GetComponent <ForceIntoGame>() != null) { other.GetComponent <ForceIntoGame>().ForceKickBallForward(); } }