-
Notifications
You must be signed in to change notification settings - Fork 16
Creating a Package
Tommee J. Armytage edited this page Oct 23, 2023
·
1 revision
-
Packages hold GameObjects inside them until the player opens it.
-
Currently there are 2 types of packages:
-
Cardboard Box - When opened, the parts spawn, the sheets fall around the parts inside and after a short while they start disappearing.
-
Crate - The player has to pry each corner of each panel. 1 panel has to be completely pried before the parts spawn inside.
-
Cardboard Box - When opened, the parts spawn, the sheets fall around the parts inside and after a short while they start disappearing.
-
See Package Settings for a list of all settings for a packge.
-
Parts packed inside a package must be initialized first!
-
Package.createPackage Signature
public virtual void createPackage(params GameObject[] objects)- Package settings initialization would look something like this:
PackageSettings packageSettings = new PackageSettings()
{
name = "Package(xxxxx)", // Package name
position = new Vector3(-9.7f, 0, 6.2f), // Package spawn position.
rotation = new Vector3(0, 180, 0), // Package spawn rotation.
scale = new Vector3(1.8f, 1.8f, 0.9f), // Package Scale.
partPositions = new Vector3[] // Position of part/s inside the package.
{
new Vector3(0.0925f, 0, 0.075f),
},
partRotations = new Vector3[] // Rotation of part/s inside the package.
{
new Vector3(90, 0, 0),
}
};- Creating a Cardboard Box
CardboardBox cardboardBox = new CardboardBox(packageSettings);
cardboardBox.createPackage(part);- Creating a Crate
Crate crate = new Crate(packageSettings);
crate.createPackage(part);- If you would like to spawn your parts in a package only when there is no save data present and when using the autosave feature, You could check if Part.doesSaveDataExist is false.
if (part.doesSaveDataExist() == false)
{
Crate crate = new Crate(packageSettings);
crate.createPackage(part);
}