Created
May 13, 2014 13:50
-
-
Save markpapadakis/a6f2cabe8a4b054dc413 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
| struct NPC | |
| { | |
| uint8_t activeScale; // higher => will execute more logic / TICK | |
| void AdjustActivityScale(const float normalizedDistanceFromPC) // Clamped to 0...1 | |
| { | |
| activeScale = normalizedDistanceFromPC * 10.0; | |
| } | |
| void OnTick(void) | |
| { | |
| switch (activeScale) | |
| { | |
| case 10: | |
| ConsiderCountryside(); | |
| // fall-through | |
| case 9: | |
| ConsiderOtherNPCs(); | |
| ConsiderWeather() | |
| //fall-through | |
| case 2: | |
| ConsiderAcceleration(); | |
| //fall-through | |
| case 1: | |
| ConsiderNearbyFoes(); | |
| ConsiderNearbyFriends(); | |
| //fall-through | |
| case 0: // Those area always executed | |
| ConsiderSelfstate(); | |
| break; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment