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