Now
to implement player health that interacts with the UI to do this create a C#
script in the script folder then drag the script onto the player in the
hierarchy, in the components section of the player in the player health section
you will see Health slider and damage image with None in the boxes next to them
you need to click on the health slider in the hierarchy and drag it onto the
box with none which will link the health slider component with the player
health script do the same with the damage image box below by dragging the
damage image from the hierarchy into the damage image none box to link it.
Now to create a game controller start by making a new game object and name it Game Controller and set it to origin position and change the tag to Game Controller and add component, new script and name it game controller, now edit the game controller script. Public class GameController : MonoBehaviour { Public GameObject hazard; Public Vector3 spawnValues; Public inthazardCount; Public float spawnWait; Public float startWait; Void start () { StartCoroutine (SpawnWaves ()); } IEnumerator SpawnWaves () { Yield return new WaitForSeconds (startWait); while (true) { For (int I = 0; i < hazardCount; i++) { Vector3 spawnPosition = new vector3 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z); Quaternion spawnRotation = Quaternion.identity; Instantiate (hazard, spawnPosition. spawnRotation); Yield return new WaitForSeconds (spawnWait); } Yield return new WaitForSeconds (waveWait); } } } Select the Game Contr...
Comments
Post a Comment