Last active
January 29, 2016 18:07
-
-
Save eddietree/a59e10f9fa9395bdf7ae to your computer and use it in GitHub Desktop.
for isaac
This file contains 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
// Problem: you are making an AI that goes to a location, stops for 1 second, then starts again | |
IEnumerator DoCoroutine() { | |
// go to a location | |
Vector3 randomDestination = GetRandomLocation(); | |
float walkTotalTime = 1.0; | |
// walk towards | |
float walkTimer = 0.0; | |
while( walkTimer < walkTotalTime ) { | |
walkTimer -= Time.delta; | |
position.MoveTowards(position, randomDestination, Time.delta); | |
yield return null; | |
} | |
// sleep one second | |
yield return new WaitForSeconds(1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment