Lab 8A - Collision, Inventory
Summary
You will implement a placeable actor that adds a counter inventory item.
Learning Outcomes
- Ability to manipulate the inventory manager
- Ability to add and interact with inventory items
Files to Implement
- L8Game.uc
- L8CounterItem.uc
- L8SpawnerBase.uc
- L8-Map.udk
Submission Requirements
Show your completed lab part A to your instructor(s) including a barrel that can be touched by the player and that adds a counter item to the player's inventory and then announces the counter item's counter value.
Instructions
L8Game
- Create the class L8Game which inherits from UTGame
- As usual, ensure that this game type is correctly set up to handle opening maps with the prefix "L8"
L8CounterItem
- Create the class L8CounterItem inherting from the class Inventory
- This class should have a single integer member variable named
counter. Initialize this to 0. - Implement the function
increment, which should accept no parameters and return nothing- This function should simply increment the value of the
countervariable
- This function should simply increment the value of the
- Implement the function
announce, which should accept no parameters and return nothing- This function should log a message that includes the current value of the
countervariable
- This function should log a message that includes the current value of the
L8SpawnerBase
- Create the class L8SpawnerBase which inherits from Actor
- Declare this class to be placeable and to be ClassGroup Lab8
- Add a static mesh component to this object and set the component's static mesh property to
StaticMesh'E3_Demo.Meshes.SM_Barrel_01' - Ensure that this actor is set to collide actors
- Implement the function Touch on this class, returning nothing and accepting the following parameters:
Actor Other, PrimitiveComponent OtherComp, Vector HitLocation, Vector HitNormal- Have this function emit a log message every time it executes
- Check if the incoming
Otheractor is in fact aPawn, if it is...- Check if the class
L8CounterItemis in its inventory- If it is not, create the item in/using Other's inventory manager
- Call the increment function on Other's counter item
- Call the announce function on Other's counter item
- Check if the class