Notifications
bg
Jorge Lopez
DTI - Executive
Puebla, Mexico
18
Likes
2
Followers
2
Connections
All
Articles0
Games3
Showcases0
Column3
Jobs0
Jorge Lopezjoined anevent
Your First Game Jam
ONLINE EVENT
2:00 PM - 5:00 PM August 27, 2019 (Local: UTC-5)
14:00 - 17:00 Aug 27, 2019 (Local: UTC-5)
140 Participants
Tutorial to add more scenes to the game

1.-
before doing anything we backup the file GameFlowManager.cs with ctrl + d.

open file GameFlowManager.cs

A) add 3 variables

Scene m_Nivel;
string m_Nivel_actual;
int m_Nivel_Nuevo;

the explanation is descriptive the use we see later

Scene m_Nivel; is to get the name of the current Scene at the time of starting the game.

With m_Nivel_actual we will get only a part of the name of the scene, this point is explained later

and m_Nivel_Nuevo; It is to send to call the new scene through a simple process of concatenation of chains.


b) in the method -- void Start ()


before the }


add these lines

m_Nivel = SceneManager.GetActiveScene ();
m_Nivel_ivel = m_Nivel.name.Substring (5, 1);
m_New_Level = Convert.ToInt32 (m_ Current_Level) + 1;


What does each line do:

m_Nivel = SceneManager.GetActiveScene (); --- get the name of the scene in my case would be Act-1

m_National_level = m_Nivel.name.Substring (5, 1); --- extract only the numeric part of the scene name and store it in a variable

m_New_Level = Convert.ToInt32 (m_Current_level) + 1; --- I perform a data conversion of type string to integer.

This is to initialize the game with controlled data, and know what scene I am and what is next to load

3 months ago
do not forget to add new and renowned scenes, build again
3 months ago
c) in the void Update () method look for the line else { remove everything internal until } and put this within {} It should look like this: else {
if (m_ObjectiveManager.AreAllObjectivesCompleted() && (m_Nivel_actual == "3")) { EndGame(true); } else { if (m_ObjectiveManager.AreAllObjectivesCompleted()) { m_SceneToLoad = "Acto-" + m_Nivel_Nuevo.ToString();
SceneManager.LoadScene(m_SceneToLoad);
gameIsEnding = false; } }
// Test if player died if (m_Player.isDead) EndGame(false); }
Explanation: else { if (m_ObjectiveManager.AreAllObjectivesCompleted() && (m_Nivel_actual == "3")--- it validates that the strablecios objectives are completed and also check which scene is the last one, in my case the last scene is 3 { EndGame(true); ---with the value in false load the scene of the WinScene. } else { if (m_ObjectiveManager.AreAllObjectivesCompleted())---the objectives are completed it is time to load the new scene through these 3 lines of code { m_SceneToLoad = "Acto-" + m_Nivel_Nuevo.ToString();---concatenates the base name of my scene plus the new scene in this case would be Acto-2
SceneManager.LoadScene(m_SceneToLoad);---with this method, load the scene by means of the name of the scene that stores the variable
gameIsEnding = false;---through a false value that the game is not over } } if (m_Player.isDead)---the player is dead EndGame(false); --with the value in false load the scene of the LoseScene.

} "save the changes". 2.- change the names of the scenes MainScene ---->Acto-1 secondaryScene ---->Acto-2 new scene ---->Acto-3 3.- click play click play and test that it works correctly. regards
Hello
good morning everyone, I already uploaded my creation and will continue to modify it, it is an excellent tutorial to work on.

regards

Link
https://connect.unity.com/p/shoter-game-1-0-alone

4 months ago
1 level more
4 months ago
update
4 months ago
I have uploaded an update :)
About Me
autodidact entrepreneur dedicated
CLEU
Director de Tecnologias
ITP
Lic. en informatica
See more
Certifications (0)
Import
See all
Jorge Lopez's liked projects (0)
No likes yet
Following (2)
Followers (2)
Following Companies (0)
Not following anyone yet