

- Adding UI Image for Score & Lives

- Adding Sprite to UI Image as “Source Image”



- Adding Sprite to UI Image as “Source Image”


- Creating UI Text to count Player’s Life

- In UI Text
- set the default Text as “0”
- change Font Style & Size


- Create UI Button for Play Button



- In UI Button
- Set the size
- Add Sprites for “Target Graphic”(usual) & “Pressed Sprite”(pressed)




- To control PlayButton&Player with GameManager
- create Public Object as a Reference
- create an Enumeration, “GameManagerState” to tell Game State
- Opening, GamePlay, and GameOver
- create a Function, “UpdateGameManagerState()”
- use “Switch Statement”
- make 3 cases
- use “Switch Statement”

- now, Play Button reacts to Clicking but nothing happens




- create “GameManager” GameObject as a reference
- set “Player” inactive for the first moment of Game
- In “Init()” method, which is called when Game Starts
- set the current life(“lives”) as MaxLife
- update UIText by using Text.text property
- change the number(int “lives”) to string by using int.Tostring() method
- set Player active when Game starts
- In “OnTriggerEnter2D()” method(when a Collision with Player happens,)
- the life is subtracted
- when the life is 0,
- use “SetManagerState” in “GameManager” Class with “GameOver”()*(putting the name of “enum”)
- hide Player GameObject by set it “false”

- update “GameManager” Script
- in “Start()” method
- set “GMState” in “Opening”
- in “UpdateGameManagerState()”
- in case of “GamePlay”,
- Set “PlayButton” active to hide it when Game Starts
- Activate “Init()” method
- in case of “GamePlay”,
- Create” SetGameMangerState()” method to change the Game’s State, having “GameManagerState”(enum) as Parameter
- in “StartGamePlay()” method
- change “GMState” into “GamePlay”
- Don’t forget to put “UpdateGameManagerState()”
- in “Start()” method

- In Play Button,
- Add Sprite for “Target Graphics”(Usual) and “Pressed Sprite”(Pressed)
- Add “On Click()” event and designate it “StartGamePlay()” method in “GameManager” Class
- with this part, No Need to write to Star Game



- Add “GameOver” Sprite
- add the sprite to GameManager
- add the Sprite to the scene

- Turn off “GameOver” for it to be hidden in the first moment of Game

- Create a Function, “UnscheduleEnemySpawner()”, to stop the spawning when the game is over” by using “CancelInvoke()”

- Create “ChangeToOpeningState()” method
- use “SetGameMangerState()” method
- In Case of “GameOver”,
- put “UnscheludeEnemySpawner()” method to stop the spanwing
- In Case of “Opening”
- turn off “GameOver” by using “GameObject.Setactive()”




































