You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
570 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class BlackHole : MonoBehaviour
  5. {
  6. [SerializeField]
  7. private float Force = 5;
  8. private void OnTriggerStay(Collider other)
  9. {
  10. var ball = other.GetComponent<BallController>();
  11. if (ball != null)
  12. ball.EatHorse = false;
  13. var horse = other.GetComponent<PlayerController>();
  14. if (horse != null)
  15. {
  16. horse.AddForce((Vector3.up * 2 + transform.forward) * Force);
  17. return;
  18. }
  19. }
  20. }