HarvesterObjects
Introduction
The HarvesterObjects
class in the Unity engine is used to define different types of harvestable objects, such as trees, rocks, or plants, and store relevant data about them, such as their mass, the amount of resources they yield, and the types of objects they can be harvested with.
Each HarvesterObjects
instance contains a reference to the prefab for the object as it appears in the game world, as well as prefabs for the objects that are generated when the object is harvested, such as wood or stone. The class also stores other useful data about the object, such as the force with which it should explode when destroyed, the time it takes for the destroyed object to despawn, and the maximum and minimum amount of resources that can be harvested from it.
Additionally, HarvesterObjects
contains a reference to the non-harvestable prefab for the object, which is used for creating non-harvestable versions of the object, such as those that might appear in the game world as part of a background environment. The class also stores information about the probability of spawning a non-harvestable version of the object, and the time it takes for that version to despawn.
Overall, the HarvesterObjects
class serves as a centralized repository for information about the harvestable objects in a game world, and makes it easy for game developers to add new types of harvestable objects to their games.
Overview Page
The HarvesterObjects
class is a ScriptableObject that defines the properties and methods of harvestable objects. It includes settings for the harvestable object, harvesting reward, tool settings, sound settings, and skill level required.
Interface Pages
None.
Constructor Pages
Constructor | Description |
---|---|
HarvesterObjects() |
Default constructor. |
Method Pages
Method | Description |
---|---|
void CreateDropPrefab(bool processFolder = false) |
Method used to create the drop prefab for the harvestable object. |
Property Pages
Property | Type | Description |
---|---|---|
tagNames |
string | The tagname associated with this object. |
harvesterFx |
ParticleSystem | The Particle FX that should be played when the object is harvested. |
harvesterGameObjectFx |
GameObject | The GameObject that should be used when the object is harvested. |
networkedHarvestableObjectPrefab |
GameObject | This is the Game Prefab that will be used to spawn in place of the existing vegetation item. This contains the HarvestableObject script. |
sceneVegetationPrefab |
GameObject | This is the object that is placed on the terrain, or the scene object. This is the visual item in the scene that will be found and then replaced with the harvestableObjectPrefab. |
nonHarvestableObjectPrefab |
GameObject | The prefab we will spawn when the HO is properly harvested and we want to simulate the removal of the object. This would be the stump in the ground or a broken rubble pile that is left after. |
nonHarvestableSceneReplacementObjectPrefab |
GameObject | The prefab we will spawn when the HO is properly harvested and we want to simulate the removal of the object. This would be the stump in the ground or a broken rubble pile that is left after. |
fallingLeavesFx |
GameObject | Particle Effects for falling leaves (development not working}. |
harvestedPrefabOffset |
Vector3 | The offset for the harvestedPrefab UI object. |
moveToGround |
bool | Move the object to the ground?. |
harvestableObjectMass |
float | This is the harvestable objects mass, used for physics calculations. |
requireHarvesterTool |
bool | Whether this object needs a harvesting tool to harvest it. |
harvestedPrefabs |
List<GameObject> | Game Objects to drop on the ground. |
amountHarvestedSpawn |
int | Minimum amount of harvested item to spawn around the harvested location. |
maxAmountHarvestedSpawn |
int | Maximum amount of harvested item to spawn around the harvested location. |
perHitHarvesting |
bool | Do you want an object per hit to appear or one one per object? |
spawnPrefabOdds |
float | The odds that something will spawn. |
harvestingRestoreTime |
float | How long before the harvesting system will restore the harvested items. |
dropDestructionDestroyTime |
float | The amount of time to destroy the spawned game object. |
nonHarvestableObjectPrefabTime |
float | The amount of time to destroy the spawned game object. |
toolType |
List<string> | The tools tag that can damage this harvestable object. |
damageToolType |
List<string> | The tag of the tool to start damaging. |
weakToolType |
List<string> | The tag of the tool to start damaging. |