示例#1
0
void ComponentEnemy::Initialize()
{
	m_TransformComponent = GET_COMPONENT(ComponentTransform2D);
	m_RigidBodyComponent = GET_COMPONENT(ComponentRigidBody);

	SetScaleLevel(0);
}
示例#2
0
void PhysicsHelper::set_half_height(EntitySystem& ents, tdt::uint id, tdt::real val)
{
	PhysicsComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, PhysicsComponent);
	if(comp)
		comp->half_height = val;
}
示例#3
0
void EventHelper::set_radius(EntitySystem& ents, std::size_t id, Ogre::Real val)
{
	EventComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, EventComponent);
	if(comp)
		comp->radius = val;
}
示例#4
0
void OnHitHelper::set_cooldown(EntitySystem& ents, tdt::uint id, tdt::real val)
{
	OnHitComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, OnHitComponent);
	if(comp)
		comp->cooldown = val;
}
示例#5
0
void StructureHelper::set_radius(EntitySystem& ents, tdt::uint id, tdt::uint radius)
{
	StructureComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, StructureComponent);
	if(comp)
		comp->radius = radius;
}
示例#6
0
void TaskHelper::set_task_source(EntitySystem& ents, tdt::uint id, tdt::uint source)
{
	TaskComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, TaskComponent);
	if(comp)
		comp->source = source;
}
示例#7
0
void TaskHelper::set_task_type(EntitySystem& ents, tdt::uint id, TASK_TYPE type)
{
	TaskComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, TaskComponent);
	if(comp)
		comp->task_type = type;
}
示例#8
0
void TaskHelper::set_complete(EntitySystem& ents, tdt::uint id)
{
	TaskComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, TaskComponent);
	if(comp)
		comp->complete = true;
}
示例#9
0
void CombatHelper::set_atk_type(EntitySystem& ents, tdt::uint id, ATTACK_TYPE type)
{
	CombatComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, CombatComponent);
	if(comp)
		comp->atk_type = type;
}
示例#10
0
void CombatHelper::set_cooldown(EntitySystem& ents, tdt::uint id, tdt::real cd)
{
	CombatComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, CombatComponent);
	if(comp)
		comp->cooldown = cd;
}
示例#11
0
void CombatHelper::set_range(EntitySystem& ents, tdt::uint id, tdt::real range)
{
	CombatComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, CombatComponent);
	if(comp)
		comp->range = range;
}
示例#12
0
void CombatHelper::set_projectile_blueprint(EntitySystem& ents, tdt::uint id, const std::string& val)
{
	CombatComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, CombatComponent);
	if(comp)
		comp->projectile_blueprint = val;
}
示例#13
0
void CombatHelper::set_target(EntitySystem& ents, tdt::uint id, tdt::uint val)
{
	CombatComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, CombatComponent);
	if(comp)
		comp->curr_target = val;
}
示例#14
0
void ExplosionHelper::set_delta(EntitySystem& ents, tdt::uint id, tdt::real val)
{
	ExplosionComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, ExplosionComponent);
	if(comp)
		comp->delta = val;
}
示例#15
0
void ExplosionHelper::increase_curr_radius(EntitySystem& ents, tdt::uint id, tdt::real val)
{
	ExplosionComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, ExplosionComponent);
	if(comp)
		comp->curr_radius += val;
}
示例#16
0
void EventHelper::set_event_handler(EntitySystem& ents, std::size_t id, std::size_t val)
{
	EventComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, EventComponent);
	if(comp)
		comp->handler = val;
}
示例#17
0
void EventHelper::set_event_type(EntitySystem& ents, std::size_t id, EVENT_TYPE val)
{
	EventComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, EventComponent);
	if(comp)
		comp->event_type = val;
}
static int rose_number_digits_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value)
{
	int i = 0;
	struct rose_component *comp = NULL;
	unsigned char *vdata = data;
	int datalen = 0;
	int res = 0;

	do {
		GET_COMPONENT(comp, i, vdata, len);
		CHECK_COMPONENT(comp, ASN1_NUMERICSTRING, "Don't know what to do with PublicPartyNumber ROSE component type 0x%x\n");
		if(comp->len > 20 && comp->len != ASN1_LEN_INDEF) {
			pri_message(pri, "!! Oversized NumberDigits component (%d)\n", comp->len);
			return -1;
		}
		if (comp->len == ASN1_LEN_INDEF) {
			datalen = strlen((char *)comp->data);
			res = datalen + 2;
		} else
			res = datalen = comp->len;
			
		memcpy(value->partyaddress, comp->data, datalen);
		value->partyaddress[datalen] = '\0';

		return res + 2;
	}
	while(0);
	
	return -1;
}
示例#19
0
void TaskHelper::set_task_target(EntitySystem& ents, tdt::uint id, tdt::uint target)
{
	TaskComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, TaskComponent);
	if(comp)
		comp->target = target;
}
static int rose_public_party_number_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value)
{
	int i = 0;
	struct rose_component *comp = NULL;
	unsigned char *vdata = data;
	int ton;
	int res = 0;

	if (len < 2)
		return -1;

	do {
		GET_COMPONENT(comp, i, vdata, len);
		CHECK_COMPONENT(comp, ASN1_ENUMERATED, "Don't know what to do with PublicPartyNumber ROSE component type 0x%x\n");
		ASN1_GET_INTEGER(comp, ton);
		NEXT_COMPONENT(comp, i);
		ton = typeofnumber_for_q931(pri, ton);

		res = rose_number_digits_decode(pri, call, &vdata[i], len-i, value);
		if (res < 0)
			return -1;
		value->ton = ton;

		return res + 3;

	} while(0);
	return -1;
}
示例#21
0
void TaskHelper::add_task(EntitySystem& ents, tdt::uint ent_id, tdt::uint task_id, bool priority)
{
	auto comp1 = ents.get_component<TaskHandlerComponent>(ent_id);
	TaskComponent* comp2{nullptr};
	GET_COMPONENT(task_id, ents, comp2, TaskComponent);
	if(comp1 && comp2)
	{
		// Make sure the entity can handle this task.
		if(!comp1->possible_tasks.test((int)comp2->task_type))
			return;

		comp2->source = ent_id;

		if(priority)
		{
			if(comp1->curr_task != Component::NO_ENTITY)
			{
				comp1->task_queue.push_front(comp1->curr_task);
				comp1->curr_task = Component::NO_ENTITY;
			}
			comp1->task_queue.push_front(task_id);
			comp1->busy = false;
		}
		else
			comp1->task_queue.push_back(task_id);
	}
}
示例#22
0
void OnHitHelper::set_blueprint(EntitySystem& ents, tdt::uint id, const std::string& val)
{
	OnHitComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, OnHitComponent);
	if(comp)
		comp->blueprint = val;
}
示例#23
0
void StructureHelper::add_residence(EntitySystem& ents, tdt::uint id, tdt::uint node_id)
{
	StructureComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, StructureComponent);
	if(comp)
		comp->residences.push_back(node_id);
}
示例#24
0
void EventHelper::set_active(EntitySystem& ents, std::size_t id, bool val)
{
	EventComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, EventComponent);
	if(comp)
		comp->active = val;
}
示例#25
0
void LimitedLifeSpanHelper::set_max_time(EntitySystem& ents, tdt::uint id, tdt::real val)
{
	LimitedLifeSpanComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, LimitedLifeSpanComponent);
	if(comp)
		comp->max_time = val;
}
示例#26
0
void PhysicsHelper::set_solid(EntitySystem& ents, tdt::uint id, bool val)
{
	PhysicsComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, PhysicsComponent);
	if(comp)
		comp->solid = val;
}
示例#27
0
void StructureHelper::set_walk_through(EntitySystem& ents, tdt::uint id, bool on_off)
{
	StructureComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, StructureComponent);
	if(comp)
		comp->walk_through = on_off;
}
示例#28
0
tdt::real LimitedLifeSpanHelper::get_curr_time(EntitySystem& ents, tdt::uint id)
{
	LimitedLifeSpanComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, LimitedLifeSpanComponent);
	if(comp)
		return comp->curr_time;
	else
		return tdt::real{};
}
示例#29
0
bool StructureHelper::is_walk_through(EntitySystem& ents, tdt::uint id)
{
	StructureComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, StructureComponent);
	if(comp)
		return comp->walk_through;
	else
		return true;
}
示例#30
0
tdt::uint StructureHelper::get_radius(EntitySystem& ents, tdt::uint id)
{
	StructureComponent* comp{nullptr};
	GET_COMPONENT(id, ents, comp, StructureComponent);
	if(comp)
		return comp->radius;
	else
		return tdt::uint{};
}