Files
uni/third/semester1/CT3536: Games Programming/notes/_minted-CT3536-Notes/B2328C2D85EA05B8F0F2B4315E1730F5A97D9E8903456DD8DEC827D96A24153A.pygtex
2023-12-07 02:05:57 +00:00

37 lines
1.8 KiB
Plaintext

\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PYG{k}{private}\PYG{+w}{ }\PYG{k}{void}\PYG{+w}{ }\PYG{n+nf}{Start}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{Debug}\PYG{p}{.}\PYG{n}{Log}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Start method\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{n}{StartCoroutine}\PYG{p}{(}\PYG{n}{TestCoroutine}\PYG{p}{());}
\PYG{+w}{ }\PYG{n}{Debug}\PYG{p}{.}\PYG{n}{Log}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Start method ends\PYGZdq{}}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// this coroutine has a loop that runs as along as the calling object is active}
\PYG{k}{private}\PYG{+w}{ }\PYG{n}{IEnumerator}\PYG{+w}{ }\PYG{n+nf}{TestCoroutine}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{Debug}\PYG{p}{.}\PYG{n}{Log}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}TestCoroutine\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{k}{while}\PYG{p}{(}\PYG{k}{true}\PYG{p}{)}
\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{Debug}\PYG{p}{.}\PYG{n}{Log}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Here\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{k}{yield}\PYG{+w}{ }\PYG{k}{return}\PYG{+w}{ }\PYG{k}{null}\PYG{p}{;}
\PYG{+w}{ }\PYG{n}{Debug}\PYG{p}{.}\PYG{n}{Log}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}There\PYGZdq{}}\PYG{p}{);}
\PYG{+w}{ }\PYG{p}{\PYGZcb{}}
\PYG{p}{\PYGZcb{}}
\PYG{k}{private}\PYG{+w}{ }\PYG{k}{void}\PYG{+w}{ }\PYG{n+nf}{Update}\PYG{p}{()}\PYG{+w}{ }\PYG{p}{\PYGZob{}}
\PYG{+w}{ }\PYG{n}{Debug}\PYG{p}{.}\PYG{n}{Log}\PYG{p}{(}\PYG{l+s}{\PYGZdq{}Update\PYGZdq{}}\PYG{p}{);}
\PYG{p}{\PYGZcb{}}
\PYG{c+c1}{// Output should be:}
\PYG{c+cm}{/*}
\PYG{c+cm}{Start method}
\PYG{c+cm}{TestCoroutine}
\PYG{c+cm}{Here}
\PYG{c+cm}{Start method ends}
\PYG{c+cm}{Update}
\PYG{c+cm}{There}
\PYG{c+cm}{Here}
\PYG{c+cm}{Update}
\PYG{c+cm}{There}
\PYG{c+cm}{Here}
\PYG{c+cm}{*/}
\end{Verbatim}