Assignment for RMIT Mixed Reality in 2020
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.

25 lines
449 B

  1. namespace Oculus.Platform.Samples.VrHoops
  2. {
  3. using UnityEngine;
  4. using System.Collections;
  5. // An AI Player just shoots a ball forward with some random delay.
  6. public class AIPlayer : Player {
  7. void FixedUpdate ()
  8. {
  9. if (HasBall)
  10. {
  11. // add a little randomness to the shoot rate so the AI's don't look synchronized
  12. if (Random.Range(0f, 1f) < 0.03f)
  13. {
  14. ShootBall();
  15. }
  16. }
  17. else
  18. {
  19. CheckSpawnBall();
  20. }
  21. }
  22. }
  23. }