BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / Platform / Samples / VrHoops / Scripts / AIPlayer.cs

AIPlayer.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
AIPlayer.cs 449 B Download Raw
1namespace 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}