resource_manager | R Documentation |
This object manages all of the resources in a village.
initialize()
Creates a new manager
get_resources()
Gets all of the resources that the manager has
get_resource()
Retrieves a resource from the manager
add_resource()
Adds a resource to the manager
remove_resource()
Removes a resource from the manager
get_resource_index()
Retrieves the index of the resource
get_states()
Returns a list of states
load()
Loads a csv file of resources and adds them to the manager.
resources
A list of resource objects
resource_class
The class used to represent resources Creates a new , empty, resource manager for a village.
new()
Get a new instance of a resource_manager
resource_manager$new(resource_class = villager::resource)
resource_class
The class being used to describe the resources being managed Gets all of the managed resources
get_resources()
resource_manager$get_resources()
A list of resources Gets a resource given a resource name
get_resource()
resource_manager$get_resource(name)
name
The name of the requested resource
A resource object Adds a resource to the manager.
add_resource()
resource_manager$add_resource(...)
...
The resources to add
None Removes a resource from the manager
remove_resource()
resource_manager$remove_resource(name)
name
The name of the resource being removed
None Returns the index of a resource in the internal resource list
get_resource_index()
resource_manager$get_resource_index(name)
name
The name of the resource being located
The index in the list, or R's default return value Returns a data.frame where each row is a resource.
get_states()
resource_manager$get_states()
Subclasses should not have to override this method because it takes all member variables into account
A single data.frame Loads a csv file of resources into the manager
load()
resource_manager$load(file_name)
file_name
The path to the csv file
None
clone()
The objects of this class are cloneable with this method.
resource_manager$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.