FluxWorldRuntime

csharp
public sealed class FluxWorldRuntime : IFluxSpawnHost

Namespace NodeWorld.SDK.Client.Flux.

Objects spawned for the room (Networking.Instantiate): copies of the network templates of the world. The spawner's copy is made at once and its scripts right after the current call; the server gives it its network id, then every player makes it too (those who arrive later as well) with the same scripts, network ids derived from the copy's ("~3", "~3/0", "~3/0/1" by sibling index) and the spawner as its owner. Until the id comes back, the spawner's states and events of the copy wait (as for an object being taken). A copy whose owner leaves stays and goes to the master.

Constructors

FluxWorldRuntime

csharp
public FluxWorldRuntime(INWLogger logger, IFluxRoom room, IFluxLocalPlayer player)

The runtime of the local player in a room: logger gets the scripts' lines, room is the network (the server's room, or LocalFluxRoom in Play mode), player the local player.

Properties

HasLoadedWorld

csharp
public bool HasLoadedWorld { get; }

A world's scripts are loaded and running.

Voice

csharp
public IFluxVoice Voice { get; set; }

The voice playback of the client (Players.SetVoice); null: the scripts' voice settings do nothing.

DefaultVideo

csharp
public static IFluxVideo DefaultVideo { get; set; }

The video players every new runtime starts with: set by NodeWorld.SDK.Video where libVLC is shipped (Windows x64 and Android arm64: client and Play mode of a world project), else null.

Video

csharp
public IFluxVideo Video { get; set; }

The video players of the client (VideoPlayer); null: the scripts' players stay unavailable.

NetworkGate

csharp
public WorldNetworkGate NetworkGate { get; set; }

The network gate of the world's web, WebSocket, images and video: the device's (WorldNetworkGate.Shared) unless set. In the Unity editor it allows everything.

WorldId

csharp
public string WorldId { get; }

The World ID of the loaded world, null when none is.

Methods

LoadWorld

csharp
public void LoadWorld(string worldId, byte[] aotModule, Scene scene, IReadOnlyCollection<GameObject> worldRoots)

Starts the scripts of the world (see IFluxWorldRuntime.LoadWorld).

UnloadWorld

csharp
public void UnloadWorld()

Stops the world's scripts, every thread with them, and frees what they made.

SceneEvent

csharp
public void SceneEvent(GameObject gameObject, ScriptEvent kind, object argument, int value)

An event of the scene for the scripts of an object (grab, use, trigger, collision...); a grab of an object with a network id takes its ownership first.

UiEvent

csharp
public void UiEvent(Component component, UiEventKind kind, double value, string text)

An event of a UI component the scripts listen to, with its value or its text.

Instantiated

csharp
public void Instantiated(GameObject copy)

A copy made by Object.Instantiate: its FL# scripts are created after the current call.

NetworkIdOf

csharp
public string NetworkIdOf(GameObject gameObject)

The network id of the object (from its FL# Script components), null when it has none.

OwnerOf

csharp
public uint OwnerOf(GameObject gameObject)

The owner of the object: the player who took it, the master when nobody did or its owner left.

IsOwner

csharp
public bool IsOwner(GameObject gameObject)

The local player owns the object.

RequestOwnership

csharp
public void RequestOwnership(GameObject gameObject)

The local player takes the object (its own scripts accepted already, in the module): at once here, the server asks the owner.

NetSend

csharp
public int NetSend(int scriptId, NetworkSendKind kind, NetworkTarget target, int playerId, string name, byte[] data)

Sends a synced state or a network event of a script. A state: 1 sent, 0 not sent, 2 waiting for the ownership; an event: 1 when the local player runs it too.

Events

ScriptsInterrupted

csharp
public event Action<int> ScriptsInterrupted

The watchdog stopped the world's scripts after that many seconds: the world stays shown.