Table of Contents

Class EntityAttachmentItem

Namespace
VoxelPlayground.Entity
Assembly
GamePlay.dll
public class EntityAttachmentItem : EntityItem
Inheritance
object
EntityAttachmentItem
Derived
Inherited Members
Extension Methods

Fields

attachDistance

[TabGroup("Attachment", false, 0)]
public float attachDistance

Field Value

float

attachObj

[TabGroup("Attachment", false, 0)]
public AttachObj attachObj

Field Value

AttachObj

attachOnStart

[TabGroup("Attachment", false, 0)]
public GameObject attachOnStart

Field Value

GameObject

carriedTooltip

[Multiline]
public string carriedTooltip

Field Value

string

connectedCharacter

[NonSerialized]
[ShowInInspector]
[SuffixLabel("Debug", false)]
public EntityCharacter connectedCharacter

Field Value

EntityCharacter

directAttachList

protected HashSet<EntityAttachmentItem> directAttachList

Field Value

HashSet<EntityAttachmentItem>

durability

[NonSerialized]
[ShowInInspector]
[SuffixLabel("Debug", false)]
public float durability

Field Value

float

durabilityDamageRelVelThreshold

public float durabilityDamageRelVelThreshold

Field Value

float

extraVoxelDatas

public List<VoxelVolume> extraVoxelDatas

Field Value

List<VoxelVolume>

freeAttachLayer

[TabGroup("Attachment", false, 0)]
public LayerMask freeAttachLayer

Field Value

LayerMask

gripPose

public GripPose gripPose

Field Value

GripPose

group

public AttachmentItemGroup group

Field Value

AttachmentItemGroup

hasAttachedOnstart

[HideInInspector]
public bool hasAttachedOnstart

Field Value

bool

hasDestroy

protected bool hasDestroy

Field Value

bool

invincibleTime

public float invincibleTime

Field Value

float

isDangerousWithWideAvoidance

public bool isDangerousWithWideAvoidance

Field Value

bool

isOnGrab

protected bool isOnGrab

Field Value

bool

itemOwner

[NonSerialized]
[ShowInInspector]
[SuffixLabel("Debug", false)]
public EntityCharacter itemOwner

Field Value

EntityCharacter

jointData

[TabGroup("Attachment", false, 0)]
[InfoBox("So somehow ModTK cannot draw property of AttachObj, so we setup a back reference to JointInfoData", InfoMessageType.Info, null)]
public JointInfoData jointData

Field Value

JointInfoData

kSnapAttachDistanceThreshold

[ShowInInspector]
[SuffixLabel("Debug", false)]
public static float kSnapAttachDistanceThreshold

Field Value

float

maxDurability

public int maxDurability

Field Value

int

myAttachLocal

public Vector3? myAttachLocal

Field Value

Vector3?

myAttachLocals

[HideInInspector]
public List<Vector3> myAttachLocals

Field Value

List<Vector3>

needCheckConnected

[TabGroup("Attachment", false, 0)]
public bool needCheckConnected

Field Value

bool

OnAttached

public Action<EntityAttachmentItem> OnAttached

Field Value

Action<EntityAttachmentItem>

OnEntityDisconnected

public Action OnEntityDisconnected

Field Value

Action

previewData

public EntityAttachmentItem.TargetAttachmentPreviewData previewData

Field Value

EntityAttachmentItem.TargetAttachmentPreviewData

saveId

[HideInInspector]
public int saveId

Field Value

int

sfxDuringActivated

public SoundEvent sfxDuringActivated

Field Value

SoundEvent

targetAttachLocal

public Vector3? targetAttachLocal

Field Value

Vector3?

targetAttachLocals

[HideInInspector]
public List<Vector3> targetAttachLocals

Field Value

List<Vector3>

targetAttachRig

[NonSerialized]
[ShowInInspector]
[SuffixLabel("Debug", false)]
public Rigidbody targetAttachRig

Field Value

Rigidbody

targetId

[HideInInspector]
public List<int> targetId

Field Value

List<int>

twoHandTipsStr

public const string twoHandTipsStr = "TwoHandTips"

Field Value

string

useDirectAttach

[TabGroup("Attachment", false, 0)]
public bool useDirectAttach

Field Value

bool

Properties

DirectAttachList

Read-only access to directly attached items (for blueprint saving)

public IReadOnlyCollection<EntityAttachmentItem> DirectAttachList { get; }

Property Value

IReadOnlyCollection<EntityAttachmentItem>

IsEquippedByCharacter

public bool IsEquippedByCharacter { get; }

Property Value

bool

IsGripMelee

public bool IsGripMelee { get; }

Property Value

bool

IsGripRanged

public bool IsGripRanged { get; }

Property Value

bool

IsWeapon

public bool IsWeapon { get; }

Property Value

bool

Methods

Activate()

public override void Activate()

Attach(Vector3, Vector3?, Quaternion)

public virtual Joint Attach(Vector3 rigTargetPos, Vector3? anchorGlobalPos, Quaternion rotation)

Parameters

rigTargetPos Vector3
anchorGlobalPos Vector3?
rotation Quaternion

Returns

Joint

Attach(Vector3, Vector3, Quaternion, Rigidbody, Vector3?, Vector3?)

public Joint Attach(Vector3 rigTargetPos, Vector3 anchorGlobalPos, Quaternion rotation, Rigidbody targetRig, Vector3? _myAttachLocal, Vector3? _targetAttachLocal)

Parameters

rigTargetPos Vector3
anchorGlobalPos Vector3
rotation Quaternion
targetRig Rigidbody
_myAttachLocal Vector3?
_targetAttachLocal Vector3?

Returns

Joint

Attach(Vector3, Vector3, Quaternion, Rigidbody)

public Joint Attach(Vector3 rigTargetPos, Vector3 anchorGlobalPos, Quaternion rotation, Rigidbody targetRig)

Parameters

rigTargetPos Vector3
anchorGlobalPos Vector3
rotation Quaternion
targetRig Rigidbody

Returns

Joint

AttachAs(EntityAttachmentItem)

public void AttachAs(EntityAttachmentItem other)

Parameters

other EntityAttachmentItem

AttachPreviewUpdate(bool)

public void AttachPreviewUpdate(bool isFirstPersonPlacing)

Parameters

isFirstPersonPlacing bool

Awake()

protected override void Awake()

BreakConnection()

protected virtual void BreakConnection()

CalculateInLowSpeedUpdate()

protected void CalculateInLowSpeedUpdate()

CancelConnectionPreview()

public void CancelConnectionPreview()

CancelPreview()

public void CancelPreview()

ControlledUpdate(float)

Let's reduce the update frequency for better performance.

public override void ControlledUpdate(float deltaTime)

Parameters

deltaTime float

CreateBlueprintEntityDataPublic(BlueprintData)

Public wrapper for creating blueprint entity data (used by HandStateSavingBlueprint for multi-group saving)

public BlueprintEntityData CreateBlueprintEntityDataPublic(BlueprintData blueprint)

Parameters

blueprint BlueprintData

Returns

BlueprintEntityData

CreateConnection(EntityAttachmentItem)

public void CreateConnection(EntityAttachmentItem otherItem)

Parameters

otherItem EntityAttachmentItem

Deactivate()

public override void Deactivate()

Detach()

public virtual void Detach()

DrawAttachPointEnabledDirs()

public void DrawAttachPointEnabledDirs()

DrawAttachPointLocals()

public void DrawAttachPointLocals()

DrawAttachPoints()

public void DrawAttachPoints()

GetConnectedEntity()

public override List<Entity> GetConnectedEntity()

Returns

List<Entity>

GetConnectionCount()

public int GetConnectionCount()

Returns

int

GetOptimalAttachPointAndRotation(Vector3, Vector3, Entity)

public EntityAttachmentItem.TargetAttachmentPreviewData GetOptimalAttachPointAndRotation(Vector3 hitPoint, Vector3 cloestPoint, Entity targetEntity)

Parameters

hitPoint Vector3
cloestPoint Vector3
targetEntity Entity

Returns

EntityAttachmentItem.TargetAttachmentPreviewData

HideConnectionPreviewObjects()

public void HideConnectionPreviewObjects()

HidePreviewObject()

public void HidePreviewObject()

InitializeData()

[Button]
public void InitializeData()

IsConnectedWith(Rigidbody)

public bool IsConnectedWith(Rigidbody rig)

Parameters

rig Rigidbody

Returns

bool

IsConnectedWithItem(EntityAttachmentItem)

public bool IsConnectedWithItem(EntityAttachmentItem entityAttachmentItem)

Parameters

entityAttachmentItem EntityAttachmentItem

Returns

bool

IsUnyielding()

Check if this EntityAttachmentItem has unyielding enabled.

public bool IsUnyielding()

Returns

bool

True if unyielding is enabled, false otherwise. Returns false if voxelDestructor is null.

OnCancelGrab()

public override void OnCancelGrab()

OnCarried(EntityCharacter)

public virtual void OnCarried(EntityCharacter character)

Parameters

character EntityCharacter

OnDestroy()

public override void OnDestroy()

OnDisable()

public virtual void OnDisable()

OnDrawGizmosSelected()

public void OnDrawGizmosSelected()

OnEnable()

public virtual void OnEnable()

OnGrab(Rigidbody)

public override void OnGrab(Rigidbody hitRig = null)

Parameters

hitRig Rigidbody

OnJointBreak(float)

public virtual void OnJointBreak(float force)

Parameters

force float

OnPutDown()

public virtual void OnPutDown()

PointAttachDectection(bool)

public bool PointAttachDectection(bool isFirstPersonPlacing)

Parameters

isFirstPersonPlacing bool

Returns

bool

RemoveConnection(EntityAttachmentItem)

public virtual void RemoveConnection(EntityAttachmentItem otherItem)

Parameters

otherItem EntityAttachmentItem

SaveBlueprintData(string)

[Button]
public void SaveBlueprintData(string saveName = null)

Parameters

saveName string

SetAttachLocal(EntityAttachmentItem, EntityAttachmentItem, Vector3, Vector3)

public void SetAttachLocal(EntityAttachmentItem item1, EntityAttachmentItem item2, Vector3 pos1, Vector3 pos2)

Parameters

item1 EntityAttachmentItem
item2 EntityAttachmentItem
pos1 Vector3
pos2 Vector3

SetInvincibleTimeForConnectedEntities(float)

protected void SetInvincibleTimeForConnectedEntities(float invincibleTime = 2)

Parameters

invincibleTime float

SetPreviewData(Transform, Vector3, Vector3)

public void SetPreviewData(Transform target, Vector3 posFrom, Vector3 posTo)

Parameters

target Transform
posFrom Vector3
posTo Vector3

ShowPreviewObject()

public virtual void ShowPreviewObject()

SmartAttachTo(EntityAttachmentItem, bool)

public bool SmartAttachTo(EntityAttachmentItem other, bool snapToClosestAttachPoint = true)

Parameters

other EntityAttachmentItem
snapToClosestAttachPoint bool

Returns

bool

Start()

protected override void Start()

TryAttachToTargetAttachmentItem()

public void TryAttachToTargetAttachmentItem()