Skip to content

Foxely/MyUnity-tool-LevelFlowEditor

 
 

Repository files navigation

See the code here

MyUnity-tool-LevelFlowEditor

image

Tutorial video (click the image):

IMAGE ALT TEXT HERE

Data :

Create data asset: Create > Level > levelFlow

Double click to open the editor windo.

*note: Keep MainScene null if you don't have a scene that needs to be consistantly exist.

Tool Bar:

toolBar

  • Save / Load

    Save/Load the data.

  • Update current scene

    If there is a corespond node of current scene on the graph view, it'll sample the gameobjects of type ConnectPoint, and project them onto level node.

    If node is not showing, please press save and load again.

  • Load all scene

    Load all scenes on the graph view onto game scene.

  • Close scenes

    Unload other previesing scenes.

Node:

  • Start Node

    startNode

    • name

      A string to specified a enterence point.

      To choise a start point, call:

     LevelFlowManager.LoadFromStart("StartPoint");
     
  • Level Node

    startNode

    • [ Async | Sync ]

      Load scene type in async or sync way.

      Async: Load in background.

      Sync: The game will wait for the scene to finish loading.

    • [ Single | Additive ]

      How the scene is going to add to current game.

      Single: Close other scene, load this scene and keep the main scene if MainScene is set.

      Additive: Add this scene to current game.

API:

You don't need to instance the manager.

Load From Start

public class LoadFirstSceneControl : MonoBehaviour
{
    public LevelMapSO data;
    private void Start()
    {
        //NOTE: You can do a check-point loading to 
        //load to the certain scene.
        LevelFlowManager.flowData = data;
        LevelFlowManager.LoadFromStart("StartPoint");
    }
}

Load Next

public class MyPoint : ConnectPoint
{
	public void LoadNext(){
    		LevelFlowManager.LoadNextScene(portSetId);
    	}
}

Event:

  • LevelFlowManager.cs

    • public static event Action<string> OnConnectPointEntered;

      Called when finish loading scene. Return the portSetGuid of the matching enternce point gameObject.

      in demo: RangeTriggerConnectPoint.cs.

      public void OnEnable()
      {
          LevelFlowManager.OnConnectPointEntered += MovePlayerHere;
      }
      public void OnDisable()
      {
          LevelFlowManager.OnConnectPointEntered -= MovePlayerHere;
      }
      private void MovePlayerHere(string _enterPoint)
      {
          if (_enterPoint == portSetId)
          {
              GameObject.FindGameObjectWithTag("Player").transform.position = transform.position;
              leaveLock = true;
          }
      }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%