World||doc136783

September 20, 2022

World

Global singleton object

Brief Introduction

World is a class for managing scenes, which is responsible for creating and finding scenes. By default, the project will have a scene resource named "map001". After starting the game, the server will create a static scene based on this resource by default and add player entities to the scene.

The objects that can be accessed by the world in different environments are different. The world in the server can access all scene objects, while the client can only access the current scene objects of the client.

Scenes are divided into static scenes and dynamic scenes. At the same time, there can only be one static scene object with the same scene resource, but there can be multiple dynamic scene objects with the same scene resource. For example, the waiting hall is unique, using static scenes, while the number of each copy scene is variable, using dynamic scenes.

Attribute

Map DefaultMap [ReadOnly] [ServerOnly]
Scenario created by the server by default
Map CurMap [ReadOnly] [ClientOnly]
Current scene of client
bool IsClient [ReadOnly]
Is it currently a client environment

Function

Map CreateDynamicMapstring mapName, bool destroyWhenEmpty ) [ServerOnly]
Create a dynamic scene
Map GetStaticMapstring mapName ) [ServerOnly]
Get static scene
Map GetMapByIDint id )
Get the scene according to the scene ID