Skip to main content

CutableObject

A class in Root.Township, Alta.Impact.

A trigger that swaps itself for another prefab when hit hard enough by a matching impact tool, like cutting a plant. The server spawns the new prefab and destroys this entity; clients play the effect.

Constructors​

MemberWhat it is
CutableObject()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private PooledObjectDefinition effectPooled effect played at the spawn point, facing away from the hit.
private NetworkEntity entityThe entity destroyed when cut.
private NetworkPrefab prefabToSpawnOnHitPrefab the server spawns in place of this object, with a random rotation.
private Transform spawningPointWhere the effect plays and the new prefab spawns.
private Vector3 spawnVelocityVelocity given to the spawned object's rigidbody.

Methods​

MemberWhat it is
protected override void HitEffect(ContactPointStructure contact)Plays the hit effect off headless, then on the server spawns prefabToSpawnOnHit with spawnVelocity and destroys this entity.