Skip to content

Commit cc58c57

Browse files
committed
8 Using Coroutines
1 parent 6683fd6 commit cc58c57

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Laser Defender/Assets/Scripts/Player.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class Player : MonoBehaviour {
1919
// Use this for initialization
2020
void Start () {
2121
SetUpMoveBoundaries();
22+
StartCoroutine(PrintAndWait());
2223
}
2324

2425
// Update is called once per frame
@@ -27,6 +28,13 @@ void Update () {
2728
Fire();
2829
}
2930

31+
IEnumerator PrintAndWait()
32+
{
33+
Debug.Log("First message sent, boss");
34+
yield return new WaitForSeconds(3);
35+
Debug.Log("The second message, yo!");
36+
}
37+
3038
private void Fire()
3139
{
3240
if (Input.GetButtonDown("Fire1"))

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,15 @@ Understand the thought process for identifying your priorities for development.
9494
3. Give the projectile some velocity so that it shoots upwards.
9595

9696
**After watching (learning outcomes)…**
97-
Instantiate a project and shoot it upwards.
97+
Instantiate a project and shoot it upwards.
98+
99+
100+
### 8 Using Coroutines ###
101+
102+
**In this video (objectives)…**
103+
104+
1. Understand the core concept of how a coroutine works.
105+
2. Create a simple coroutine that prints to the console, yields for 3 seconds, then prints to the console again.
106+
107+
**After watching (learning outcomes)…**
108+
Understand the basics of how coroutines work.

0 commit comments

Comments
 (0)