Skip to content

CardboardBox

Tommo J. Phillips edited this page Oct 22, 2023 · 3 revisions

CardboardBox

Namespace: TommoJProductions.ModApi.Attachable

Represents The Cardboard Box (Package). Can hold multiple parts. Can be unpacked. Press the use button while looking at the package to open it.

public class CardboardBox : Package

Inheritance ObjectPackageCardboardBox

Properties

opened

Has the cardboard box been opened.

public bool opened { get; }

Property Value

Boolean

foldingBox

The folding box instance. (cardboard box with physics)

public GameObject foldingBox { get; }

Property Value

GameObject

sheets

The folding box sheet parent. all sheets are a child of this transform.

public Transform sheets { get; }

Property Value

Transform

behaviour

The cardboard box behaviour.

public CardboardBoxBehaviour behaviour { get; }

Property Value

CardboardBoxBehaviour

packagePrefab

The cardboard box prefab.

public virtual GameObject packagePrefab { get; }

Property Value

GameObject

packedObjects

All the parts inside the package.

public GameObject[] packedObjects { get; }

Property Value

GameObject[]

package

The package gameobject. The carboard box.

public GameObject package { get; }

Property Value

GameObject

model

The packages model.

public GameObject model { get; }

Property Value

GameObject

settings

The package settings. pos, rot, size, part pos, rot.

public PackageSettings settings { get; }

Property Value

PackageSettings

packageRigidBody

The packages rigidbody.

public Rigidbody packageRigidBody { get; }

Property Value

Rigidbody

packageMass

The total calculated mass of the package.

public float packageMass { get; }

Property Value

Single

Constructors

CardboardBox()

Sets Package parameters to defaults.

public CardboardBox()

CardboardBox(String)

Sets Package parameters. Default position. (0, 0, 0) Haybed out back of house.

public CardboardBox(string name)

Parameters

name String
The name of the package

CardboardBox(String, Vector3, Vector3, Vector3)

Sets Package parameters.

public CardboardBox(string name, Vector3 packagePosition, Vector3 packageRotation, Vector3 packageScale)

Parameters

name String
The name of the package

packagePosition Vector3
The package spawn position.

packageRotation Vector3
The package spawn rotation

packageScale Vector3
The package scale.

CardboardBox(PackageSettings)

Sets Package parameters.

public CardboardBox(PackageSettings packageSettings)

Parameters

packageSettings PackageSettings

Methods

sheetVanish()

Waits then picks a random child and destorys it. Repeats until there arent anymore sheets.

protected virtual IEnumerator sheetVanish()

Returns

IEnumerator
USAGE: StartCoroutine()

openPackage()

Opens the cardboard box.

public virtual void openPackage()

createPackage(GameObject[])

Creates the cardboard box.

public virtual void createPackage(GameObject[] objects)

Parameters

objects GameObject[]

Clone this wiki locally