Created
August 4, 2015 12:39
-
-
Save mackthehobbit/9fc13b0a935f996b7778 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <string> | |
class Level; | |
class Mob; | |
class TileSource; | |
class Vec3; | |
class Vec2; | |
class MobFactory { | |
public: | |
MobFactory(Level &); | |
Mob *CreateMob(int entityType, TileSource &ts, const Vec3 &position, Vec2 *rotation); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// could be any class, this is just an example | |
// anywhere you can get a Level instance, you could spawn a mob by the same method | |
class SomeItem : public Item { | |
public: | |
... | |
virtual void use(ItemInstance&, Player &player) { | |
// 32 = zombie | |
player.level->mobFactory->CreateMob(32, player.region, player.getPos(), player.getRotation()); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment