Refactored dynamic variable system, removed _ATTRIBUTE and type dependency, and optional default value issues.
Moved all slime kind related stuff out of global monster update loop.pull/28/head
parent
ac93b32e8a
commit
54e72d088e
@ -1,11 +0,0 @@ |
||||
#include "MonsterAttribute.h" |
||||
#define SETUP(attribute,type) _ATTRIBUTE attribute{ATTRIBUTE_TYPE::type}; |
||||
|
||||
SETUP(Attribute::IFRAME_TIME_UPON_HIT,FLOAT); |
||||
SETUP(Attribute::SHOOT_RING_TIMER,FLOAT); |
||||
SETUP(Attribute::SHOOT_RING_DELAY,FLOAT); |
||||
SETUP(Attribute::SHOOT_RING_COUNTER,FLOAT); |
||||
|
||||
int _ATTRIBUTE::internal_id=0; |
||||
_ATTRIBUTE::_ATTRIBUTE(ATTRIBUTE_TYPE type) |
||||
:type(type),id(internal_id++){} |
@ -1,29 +1,15 @@ |
||||
#pragma once |
||||
#define VARIANTS float,int,std::string,bool |
||||
#include <string> |
||||
#define F(attr) GetFloat(attr) |
||||
#define I(attr) GetInt(attr) |
||||
#define S(attr) GetString(attr) |
||||
#define B(attr) GetBool(attr) |
||||
|
||||
enum class ATTRIBUTE_TYPE{ |
||||
FLOAT, |
||||
INT, |
||||
STRING, |
||||
BOOL, |
||||
}; |
||||
|
||||
struct _ATTRIBUTE{ |
||||
ATTRIBUTE_TYPE type; |
||||
_ATTRIBUTE(ATTRIBUTE_TYPE type); |
||||
private: |
||||
static int internal_id; |
||||
int id; |
||||
public: |
||||
bool operator<(const _ATTRIBUTE&rhs)const{ |
||||
return int(id)<int(rhs.id); |
||||
} |
||||
}; |
||||
|
||||
struct Attribute{ |
||||
#define SETUP(attribute) static _ATTRIBUTE attribute; |
||||
SETUP(IFRAME_TIME_UPON_HIT); |
||||
SETUP(SHOOT_RING_TIMER); |
||||
SETUP(SHOOT_RING_DELAY); |
||||
SETUP(SHOOT_RING_COUNTER); |
||||
enum class Attribute{ |
||||
IFRAME_TIME_UPON_HIT, |
||||
SHOOT_RING_TIMER, |
||||
SHOOT_RING_DELAY, |
||||
SHOOT_RING_COUNTER, |
||||
SHOOT_RING_RIGHT, |
||||
}; |
Loading…
Reference in new issue