KS.Reactor.ksSpawnParams Class Reference

Parameters for spawning entities. More...

Inheritance diagram for KS.Reactor.ksSpawnParams:
KS.Reactor.Client.Unity.ksClientSpawnParams KS.Reactor.ksSpawnParams2D KS.Reactor.Client.Unity.ksClientSpawnParams2D

Public Types

enum class  ScaleModes { RELATIVE = 0 , ABSOLUTE = 1 }
 Scale modes More...
 

Public Member Functions

 ksSpawnParams ()
 Constructor More...
 
 ksSpawnParams (string entityType)
 Constructor More...
 
virtual bool Validate (bool log=true)
 Validates the parameters. More...
 
virtual void Release ()
 Returns the spawn parameters object to the pool. More...
 

Static Public Member Functions

static ksSpawnParams Create ()
 Fetches a ksSpawnParams from the pool, or creates one if the pool is empty. More...
 
static ksSpawnParams Create (string entityType)
 Fetches a ksSpawnParams from the pool, or creates one if the pool is empty. More...
 

Protected Member Functions

virtual void TransformAssigned ()
 Base classes can derive this to take action when a new transform is assigned. More...
 
void Release< T > ()
 Returns the spawn parameters object to the pool. More...
 
virtual void Reset ()
 Resets parameters to their default values. More...
 

Static Protected Member Functions

static T Create< T > ()
 Fetches a T from the pool, or creates one if the pool is empty. More...
 

Protected Attributes

string m_entityType
 
uint m_assetId
 

Properties

string EntityType [get, set]
 The entity type to spawn. More...
 
ksTransformState Transform [get, set]
 The transform to spawn at. More...
 
ScaleModes ScaleMode [get, set]
 Is the spawn scale a relative or absolute scale? More...
 
Dictionary< uint, ksMultiTypeProperties [get, set]
 Properties to spawn with. More...
 
uint OwnerId [get, set]
 The player id of the owner to spawn with. Zero for no owner. More...
 
ksOwnerPermissions Permissions [get, set]
 The owner permissions to spawn with. Does nothing if not spawning with an owner. More...
 
ksPlayerController PlayerController [get, set]
 A clone of this controller will be attached to the spawned entity. More...
 

Detailed Description

Parameters for spawning entities.

Member Enumeration Documentation

◆ ScaleModes

Scale modes

Enumerator
RELATIVE 

Set the spawned entity scale to the parameter scale multiplied by the prefab scale.

ABSOLUTE 

Set the spawned entity scale to the parameter scale.

If spawning an entity collection, the first entity's scale is set to the parameter scale, and all other entities are scaled relative to the first entity. If the first entity's scale contains any zeros, all entities will use the same absolute scale.

Eg. if an entity collection contains 2 entity prefabs and the first has scale (2, 2, 2) and the second has scale (1, 1, 1) and the spawn parameter scale is absolute (4, 4, 4), the first entity will be spawned with scale (4, 4, 4) and the 2nd will have (2, 2, 2).

Constructor & Destructor Documentation

◆ ksSpawnParams() [1/2]

KS.Reactor.ksSpawnParams.ksSpawnParams ( )

Constructor

◆ ksSpawnParams() [2/2]

KS.Reactor.ksSpawnParams.ksSpawnParams ( string  entityType)

Constructor

Parameters
entityTypeEntity type to spawn

Member Function Documentation

◆ Create() [1/2]

static ksSpawnParams KS.Reactor.ksSpawnParams.Create ( )
static

Fetches a ksSpawnParams from the pool, or creates one if the pool is empty.

Returns
Spawn parameters

◆ Create() [2/2]

static ksSpawnParams KS.Reactor.ksSpawnParams.Create ( string  entityType)
static

Fetches a ksSpawnParams from the pool, or creates one if the pool is empty.

Parameters
entityTypeEntity type to spawn
Returns
Spawn parameters

◆ Create< T >()

static T KS.Reactor.ksSpawnParams.Create< T > ( )
staticprotected

Fetches a T from the pool, or creates one if the pool is empty.

Template Parameters
TType of spawn parameters to create.
Returns
Spawn parameters
Type Constraints
T :ksSpawnParams 

◆ Release()

virtual void KS.Reactor.ksSpawnParams.Release ( )
virtual

Returns the spawn parameters object to the pool.

Reimplemented in KS.Reactor.ksSpawnParams2D, KS.Reactor.Client.Unity.ksClientSpawnParams2D, and KS.Reactor.Client.Unity.ksClientSpawnParams.

◆ Release< T >()

void KS.Reactor.ksSpawnParams.Release< T > ( )
protected

Returns the spawn parameters object to the pool.

Template Parameters
TType of spawn parameters
Type Constraints
T :ksSpawnParams 

◆ Reset()

virtual void KS.Reactor.ksSpawnParams.Reset ( )
protectedvirtual

Resets parameters to their default values.

Reimplemented in KS.Reactor.Client.Unity.ksClientSpawnParams.

◆ TransformAssigned()

virtual void KS.Reactor.ksSpawnParams.TransformAssigned ( )
protectedvirtual

Base classes can derive this to take action when a new transform is assigned.

Reimplemented in KS.Reactor.ksSpawnParams2D, and KS.Reactor.Client.Unity.ksClientSpawnParams2D.

◆ Validate()

virtual bool KS.Reactor.ksSpawnParams.Validate ( bool  log = true)
virtual

Validates the parameters.

Parameters
logTrue to log warnings
Returns
True if the spawn parameters are valid.

Reimplemented in KS.Reactor.Client.Unity.ksClientSpawnParams.

Property Documentation

◆ EntityType

string KS.Reactor.ksSpawnParams.EntityType
getset

The entity type to spawn.

Leave null or empty string to spawn an empty entity. Otherwise if the entity type cannot be found, no entity will be spawned.

◆ OwnerId

uint KS.Reactor.ksSpawnParams.OwnerId
getset

The player id of the owner to spawn with. Zero for no owner.

◆ Permissions

ksOwnerPermissions KS.Reactor.ksSpawnParams.Permissions
getset

The owner permissions to spawn with. Does nothing if not spawning with an owner.

◆ PlayerController

ksPlayerController KS.Reactor.ksSpawnParams.PlayerController
getset

A clone of this controller will be attached to the spawned entity.

Does nothing if not spawning with an owner.

◆ Properties

Dictionary<uint, ksMultiType> KS.Reactor.ksSpawnParams.Properties
getset

Properties to spawn with.

◆ ScaleMode

ScaleModes KS.Reactor.ksSpawnParams.ScaleMode
getset

Is the spawn scale a relative or absolute scale?

◆ Transform

ksTransformState KS.Reactor.ksSpawnParams.Transform
getset

The transform to spawn at.