Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Change/Load Scene Inside Function? #20

Open
herbertmilhomme opened this issue Oct 4, 2020 · 3 comments
Open

How to Change/Load Scene Inside Function? #20

herbertmilhomme opened this issue Oct 4, 2020 · 3 comments

Comments

@herbertmilhomme
Copy link

I wrote a game framework to separate game logic from unity visual. Everything for game is done inside a big function (method). When game should load new scene or level, i use interface to call IInterface.Initialize(new IScene). But GameFramework only change scene inside OnUpdate()?

image

@herbertmilhomme
Copy link
Author

Is it possible to change scene without Procedure and not have any issues?

I want to do this...
image

@herbertmilhomme
Copy link
Author

Is this okay? Do i need to use ProcedureManager? What about ChangeState<ProcedureChangeScene>(procedureOwner); and Scene change animation?

image

@yika-aixi
Copy link

Procedure is more like a state stage of the current game. You can switch scenes in your own way. Procedure will not be affected by your logic. Procedure in StarForce is just a way of using it. You can ignore it completely. You can also just create a Procedure, then load the scene in your own code.

class Procedure1
{
  
     Enter()
     {
         //Current game state initialization ....

        eventManager.Register("LoaScene",_loadScene)
     }

     string _nextScene;

     Update()
     {
        //Some logic that needs to be updated .....
       
       //2
       if(_nextScene != null)
       {
            SceneManager.LoadScene(arg)
           _nextScene = null
       }

     ///3
      if(owner.HasData(nextScene))
      {
          SceneManager.LoadScene(arg)
          owner.RemoveData(nextScene)
      }
     }

     //1
     _loadScene(arg)
     {
        SceneManager.LoadScene(arg)
     }

}

I have written three pseudo code ways, hoping to help you, scene loading you can do anywhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants