Time for action – Calling non-state functions
Before we get into this experiment, there's a small cleanup job we have to do. We'll leave the single-enemy code intact; we'll just take out our Tick
logging stuff.
Delete the non-state
Tick
function as well as theNoState
function.Take the
NoState
timer out of theRunAway
function:function RunAway() { GoToState('Fleeing'); }
Delete the log lines from the
Seeking
,Attacking
, and Fleeing states'Tick
functions.There we go, now we're ready to start our next experiment. First, let's set up a repeating timer by adding a
PostBeginPlay
function:function PostBeginPlay() { SetTimer(1.0, true, 'LogTimer'); }
Every second we'll be calling this new function.
Now let's create the
LogTimer
function:function LogTimer() { `log("========================"); `log("Global call:"); Global.LogMe(); `log("Non-Global call:"); LogMe(); }
A lot of stuff here, but it's simple. First, we call Global.LogMe
, then a normal LogMe
. We'll see the difference soon.
Let...