Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the situation listed below, draw a UML Class Diagram using Lucid Chart to design the system. Video Games We want to represent a simple

For the situation listed below, draw a UML Class Diagram using Lucid Chart to design the system. Video Games We want to represent a simple video game environment. Within this game, we pretty much have the basics: An environment Entities Characters Items Environments are usually where a game takes place, containing: A collection of entities Maximum entities Temperature Visibility The Environment has two core functions: addEntity, which takes in a reference to an entity and adds it to the list depending on whether or not the maximum occupancy has been reached. removeEntity, which takes in a reference of an entity and removes it. The Environment and its functions can be further extended through several biomes such as a Cave, a Forest, a Desert, an Ocean, and the Arctic. Entities can be separated into two categories: Items and Characters. Items contain the following attributes Weight Size Items have two functions, use which takes reference to an entity object for the item to be used on, and observe which prints out a description of the item to standard out. These functions are purely virtual which should be implemented in all child classes. An Item-Chest is an item child that has two functions, addItem which takes in a reference to an item and returns if the function was able to successfully add the item to the chests list and removeItem which takes in a reference to an item and

returns if the function was able to be removed from the chest. The Item-Chest class contains these following attributes: Items (A list of references to items contained in the chest) MaxItems A Water-Bottle is an item child that has the following attributes: MaxVolume CurrentVolume Characters The Character class is an abstraction for two types of Characters that will be present in the game, NPCs and the Player. All Characters contain the follow attributes upon creation: health movement speed behaviors Each attribute of a Character should have getters and setters as things like the environment and other Characters can affect these values. When a character is set to move, they will take in a 2D coordinate and change their position to that coordinate. This function will return if the movement was a successful move. A Player is a child class of the Character abstract class and will contain the following additional attributes upon creation: inventory (a vector of items) The Player can also use an action called rest, where for some time the Player will wait and heal. This function will return how much health the Player restored. NPCs are also a child class of Character but with a bit more simplicity in terms of added attributes. NPCs have a function called talkTo that prints to standard out some dialog from that NPC

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

Students also viewed these Databases questions