wiki.sine.space | sinespace

Scripting/SScene

From wiki.sine.space
Revision as of 09:03, 11 December 2020 by Voidtech (Talk | contribs) (Added simple example to SScene.Find)

Jump to: navigation, search

The SScene class represents the region the user is currently in.

Members

Find

SGameObject Find (string name);

Finds a single Game Object matching 'Name' and returns it. Can use '/' characters to designate a path (e.g. 'Parent/Child' returns Child with 'Parent')

5e
 hand = Space.Scene.Find("Hand");
--This returns the GameObject named Hand.

hand = Space.Scene.Find("/Hand");
--This returns the GameObject named Hand.
--Hand must not have a parent in the Hierarchy view.

hand = Space.Scene.Find("/Monster/Arm/Hand");
--This returns the GameObject named Hand,
--which is a child of Arm > Monster.
--Monster must not have a parent in the Hierarchy view.

hand = Space.Scene.Find("Monster/Arm/Hand");
--This returns the GameObject named Hand,
--which is a child of Arm > Monster. 


PlayerAvatar

SAvatar PlayerAvatar { get; }

Returns the current player avatar. If this script is calling this upon initialisation, the Player may not exist yet, and you will want to wait a few frames until the avatar is present before continuing.

No example provided yet


Avatars[]

SAvatar Avatars[] { get; }

Returns a list of Avatars in the scene

No example provided yet


Objects[]

SGameObject Objects[] { get; }

Returns a list of Objects in the scene. IMPORTANT: This function is slow, you should cache the result and avoid calling this every frame.

No example provided yet


CreateGameObject

SGameObject CreateGameObject (string name);

Creates a new empty game object with the name 'Name' and returns a reference

No example provided yet


CreateGameObject

SGameObject CreateGameObject (SResource resource);

Creates a game object from the specified resource

No example provided yet


Name

string Name { get; }

Returns the name of the current region

No example provided yet


Url

string Url { get; }

Returns the URL of the current region

No example provided yet


Owner

long Owner { get; }

Returns the avatar ID of the regions owner

No example provided yet


PlayerIsOwner

bool PlayerIsOwner { get; }

Returns whether the current player is the owner of the region

No example provided yet


OnPlayerJoin

void OnPlayerJoin (Action<SAvatar> callback)

Event which fires whenever a player joins the region

No example provided yet


OnPlayerLeave

void OnPlayerLeave (Action<long> callback)

Event which fires whenever a player leaves the region

No example provided yet