I setup the main camera in an isometric way and to do that
we want to use orthographic instead of perspective in the main camera inspector
tab. So, in the transform section I set the position x=1, y=15 and z=-22. Then
in the row below that, the rotation x=30, y=0 and z=0 after which we change the
projection from perspective to orthographic and the size to 4.5 which should
now be displayed in the game view tab. After that to make sure the background
or the areas outside of the environment aren’t visible click on the colour
block next to the background label in the inspector tab which should bring up a
colour palette in which you can choose whatever colour you wish I chose black
for mine.
Next in the projects tab if you haven’t already
make a scripts folder in the assets folder then make a camera folder if you
want to keep things nice and tidy, then click on the create button and select
C# script which will create something named NewBehaviourScript and is important
to name the scripts correctly otherwise there will be problems when it comes to
referencing them in other areas later. So, rename it from newbehaviourscript to
CameraFollow and press enter and once that’s name click on it and it will open
in monodevelop which will give you a screen with a few lines of code. After
entering the code into monodevelop go to the unity editor and click and drag
the CameraFollow script onto the main camera in the hierarchy tab and when you
click on main camera in the hierarchy there should now be a section with the
cameraFollow script we then want to drag from the hierarchy the player and drop
it into the target box located in the main cameras camerafollow script.
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