Show / Hide Table of Contents

# Class EntityLogic

Base class for simple (not controlled by controller) entity

##### Inheritance

object
InternalBaseClass
InternalEntity
EntityLogic
PawnLogic

##### Implements

IComparable<InternalEntity>

##### Inherited Members

InternalEntity.ClassId
InternalEntity.Id
InternalEntity.EntityManager
InternalEntity.IsServer
InternalEntity.IsClient
InternalEntity.Version
InternalEntity.IsDestroyed
InternalEntity.IsLocalControlled
InternalEntity.IsRemoteControlled
InternalEntity.IsServerControlled
InternalEntity.ClientManager
InternalEntity.ServerManager
InternalEntity.OwnerId
InternalEntity.IsLocal
InternalEntity.Destroy()
InternalEntity.OnDestroy()
InternalEntity.Update()
InternalEntity.OnBeforeRollback()
InternalEntity.OnRollback()
InternalEntity.VisualUpdate()
InternalEntity.OnConstructed()
InternalEntity.CompareTo(InternalEntity)
InternalEntity.GetHashCode()
InternalEntity.ToString()
InternalBaseClass.ExecuteRPC(in RemoteCall)
InternalBaseClass.ExecuteRPC<T>(in RemoteCall<T>, T)
InternalBaseClass.ExecuteRPC<T>(in RemoteCallSpan<T>, ReadOnlySpan<T>)
InternalBaseClass.ExecuteRPC<T>(in RemoteCallSerializable<T>, T)
InternalBaseClass.OnSyncRequested()

###### Namespace: LiteEntitySystem

###### Assembly: LiteEntitySystem.dll

##### Syntax

    public abstract class EntityLogic : InternalEntity, IComparable<InternalEntity>

### Constructors

#### EntityLogic(EntityParams)

##### Declaration

    protected EntityLogic(EntityParams entityParams)

##### Parameters

Type | Name | Description
--- | --- | ---
EntityParams | entityParams |

### Fields

#### Childs

Child entities (can be used for transforms or as components)

##### Declaration

    public readonly SyncHashSet<EntitySharedReference> Childs

##### Field Value

Type | Description
--- | ---
SyncHashSet<EntitySharedReference> |

### Properties

#### ParentId

##### Declaration

    public EntitySharedReference ParentId { get; }

##### Property Value

Type | Description
--- | ---
EntitySharedReference |

#### SharedReference

##### Declaration

    public EntitySharedReference SharedReference { get; }

##### Property Value

Type | Description
--- | ---
EntitySharedReference |

### Methods

#### AddPredictedEntity<T>(ref SyncVar<EntitySharedReference>, Action<T>)

Create predicted entity (like projectile) that will be replaced by server entity if prediction is successful Should be called also in rollback mode if you use EntityLogic.Childs

##### Declaration

    public void AddPredictedEntity<T>(ref SyncVar<EntitySharedReference> targetReference, Action<T> initMethod = null) where T : EntityLogic

##### Parameters

Type | Name | Description
--- | --- | ---
SyncVar<EntitySharedReference> | targetReference | SyncVar of class that will be set to predicted entity and synchronized once confirmation will be received
Action<T> | initMethod | Method that will be called after entity constructed

##### Type Parameters

Name | Description
--- | ---
T | Entity type

#### AddPredictedEntity<T>(Action<T>)

Create predicted entity (like projectile) that will be replaced by server entity if prediction is successful Should be called also in rollback mode

##### Declaration

    public T AddPredictedEntity<T>(Action<T> initMethod = null) where T : EntityLogic

##### Parameters

Type | Name | Description
--- | --- | ---
Action<T> | initMethod | Method that will be called after entity constructed

##### Returns

Type | Description
--- | ---
T | Created predicted local entity

##### Type Parameters

Name | Description
--- | ---
T | Entity type

#### DisableLagCompensationForOwner()

Disable lag compensation for player that owns this entity

##### Declaration

    public void DisableLagCompensationForOwner()

#### EnableLagCompensationForOwner()

Enable lag compensation for player that owns this entity

##### Declaration

    public void EnableLagCompensationForOwner()

#### GetFrameSeed()

##### Declaration

    public int GetFrameSeed()

##### Returns

Type | Description
--- | ---
int |

#### GetParent<T>()

Get parent entity

##### Declaration

    public T GetParent<T>() where T : EntityLogic

##### Returns

Type | Description
--- | ---
T | parent entity

##### Type Parameters

Name | Description
--- | ---
T | Type of entity

#### OnBeforeParentDestroy()

Called before parent destroy

##### Declaration

    protected virtual void OnBeforeParentDestroy()

#### OnLagCompensationEnd()

Called when lag compensation ended for this entity

##### Declaration

    protected virtual void OnLagCompensationEnd()

#### OnLagCompensationStart()

Called when lag compensation was started for this entity

##### Declaration

    protected virtual void OnLagCompensationStart()

#### RegisterRPC(ref RPCRegistrator)

Method for registering RPCs and OnChange notifications

##### Declaration

    protected override void RegisterRPC(ref RPCRegistrator r)

##### Parameters

Type | Name | Description
--- | --- | ---
RPCRegistrator | r |

##### Overrides

InternalEntity.RegisterRPC(ref RPCRegistrator)

#### SetParent(EntityLogic)

Set parent entity

##### Declaration

    public void SetParent(EntityLogic parentEntity)

##### Parameters

Type | Name | Description
--- | --- | ---
EntityLogic | parentEntity | parent entity

### Implements

IComparable<T>