Last active
August 29, 2015 14:22
-
-
Save Henry-E/a81868cbe0d9d3052153 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // this needs to go into the ship's AI script | |
| public integer numFramesBetweenAICall; | |
| integer currentFrame; | |
| void Awake() | |
| { | |
| numFramesBetweenAICall = 5; | |
| currentFrame = 0; | |
| } | |
| void Update() | |
| { | |
| currentFrame = mathf.repeat(currentFrame + 1, numFramesBetweenAICall); | |
| if(currentFrame == 1) | |
| { | |
| // run AI logic | |
| // for example | |
| // closestAsteroid = GameManager.instance.ClosestAsteroid(transform); | |
| // then do something with closestAsteroid | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment