A Developer's Resource
&
Co..

ZeredaGames

Let's Play!

Blog

January 21 2019

Posted on 23 February, 2019 at 10:10

Today, Ive completed the base of the program state engine. This script is designed to not get destroyed on scene change and controls how all the scenes change. Depending on the GameType enum variable, determines which level is loaded. all play buttons set the GameType to which game the user clicked and then saves the data to disk with 2 variables, a number for build index number and a string for the GameType as you cannot save anything but a string int or float by default. Then the function attached to the button, calls the level load function and auto loads loading scene. This way in the update method (that checks every frame) checks what GameType is set to via the two variables, if scene is the loading scene by the build index number (always constant), first it checks what the string is set too,and if the string changes on a frame this is a signal for the script to change state, whatever the string is set to (always equals one of the GameTypes varables) sets the state and loads the levelInt that was just set by the button seconds before, and load that build index number scene. if the game is set to none, it always auto loads Scene "1" [home scene].

*Note: in the build index though, this really is scene 6 as mentioned in a previous post

-》 the order of scenes completed

 

if a scene is locked it sets it to load home scene at this time. I may change this soon to display error message instead of load a scene, as the user may want to pick another game and not have to loop back like current.

 

Reasons a level would be locked:

- paid for game (not FreeToPlay).

- Game isn't complete or ready.

- Game scene does't exist in build settings.

 

when in editor mode (building game in unity) all scenes are unlocked, only locks scenes on test builds and final releases.

 

set up 4 music players instead of 3. loading scene now has its own player and game music gets turned off on loading scene only.

 

-Music player on first 4 scenes loop same song set in the play list as first 4 songs, any other scene the list starts at 5 (if it gets to the end of the play list) otherwise it contunues to play what ever song is currently set in the musicPlayer, and auto change to next song in list when song clip ends.

 

-Loading player has a list of random Erie music that's sort of soft and quiet like ambient noise and randomly picks a number between 0 and list count and plays that clip number out of the array list, and loops it until scene loads. All clips are 3 min long and should never loop as loading should only take seconds.

 

-Sfx player is always active and not on loop, this way we can use it for sounds played by UI aka scene buttons and actions,

 

-Ambient noise player, disabled everywhere except options panel, and actual game scenes (not menu's.)

 

Script on start of each instance (1 time at start of game as it doesn't destroy) auto fills the play lists for each player from a saved resource asset. these assets were created so a developer (aka me ) can make an editor window for me to change and edit the song lists when working in unity.

 

Since I'll be making my own editor window I can make it do anything I want really, I can auto fill the lists from folders in resources I make and set up, I can rename song file names, I can rearrange the lists alphabetically a-z or z-a, song length longest to shortest or shortest to longest or manually set list to a specific order, make a play button to play the songs in the editor window to see if i like it and a delete button to remove it from list if i dont.

 

Goals for tomorrow:

Hoping to get google play login working, to test this ill have to build a test build and put it on web and try it out. if it works ill add a link in a new post. anything else is a bonus extra :).

 

That's all for now,

 

Thamas bell @ ZG

Categories: None

Post a Comment

Oops!

Oops, you forgot something.

Oops!

The words you entered did not match the given text. Please try again.

0 Comments