Class EnvironmentalComponent
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.Environmental.EnvironmentalComponent
Universal component used for environmental objects. Currently in initial
testing phase. With additional
environmental objects to be created.
An environmental component has a set of attributes based off the
environmental type
to be used for attaching to entities.
Example of correct usage when attaching to entity is (Using a rock):
new
EnvironmentalComponent().setType(EnvironmentalComponent.EnvironmentalType.ROCK)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum containing the associate values for the environmental component An environmental component has: resourceType: The type of resource resourceValue: The number of resources to be returned associated with resource type E.g A cobweb has resourceValue = 0, speedModifier = 0.6 indicating zero resources will be given when broken and when a player walks through it, their speed is reduced by 40%static enum
Types of resources -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.deco2800.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
EnvironmentalComponent
public EnvironmentalComponent()
-
-
Method Details
-
create
public void create()Sets the component to be UNDEFINED on startup -
getObstacle
- Returns:
- The Enum type of environmental object with associated attributes
-
setObstacle
Basic setter of component type- Parameters:
obstacle
- the type of component from EnvironmentalType- Returns:
- itself (EnvironmentalComponent) to be used in Obstacle Factory
-
getResourceAmount
- Returns:
- The number of resources when the Environmental Type is broken/destroyed
-
getType
- Returns:
- the resource type
-