-
Notifications
You must be signed in to change notification settings - Fork 0
IPickup
Nick Stapleton edited this page Jun 10, 2019
·
3 revisions
This bad boy is attached to a GameObject, sits there, and waits to be called in DotSpawner.Kill()
when an AI dies. All values of the pickup are determined to the parent's value on IPickup.init()
.
Change this logic to determine the values in IPickup.Spawn()
if you want the pickups to get the values
of the owner at death instead of at spawn.
A better approach would have been to use enums
for the types instead of strings. Also, the pickups could have derived from a base class and we could have implemented each type of pickup as its own class instead of having one type of pickup that handles the logic for all types of pickup data.
namespace Pickup.Command
{
public interface IPickup
{
// initializes the pickup after attaching it to a game object.
// this sets the values of the pickup to be used when the player "eats it"
void init(IGeo geo, string t);
// programtically creates the pickup drop at the location
GameObject Spawn(Vector3 Location);
// the collision logic to ignore projectiles and AI
void OnCollisionEnter(Collision geo);
// wreck dat ho
void Destroy();
// returns the type of pickup, ie HP, armor, etc
string GetType();
// sets the type. will only affect successive calls to Spawn()
void SetType(string t);
}
}
ECS 189L Group Members- Megan Brown, Brian Coe, David Lee, Kyle Catapusan, Nick Stapleton