示例#1
0
game_object& game_object::move_bottom() {
	if (_parent == nullptr || _pre_sibling == null)
		return *this;
    
	auto* parent = _parent;
    
	this->retain();
	remove_self();
	parent->add_child(this);
	this->release();
    return *this;
}
示例#2
0
文件: entity.cpp 项目: ericandoh/Bawk
bool Entity::get_hurt(float x, float y, float z, float dmg, BreakablePolicy policy, Player* player) {
    uint32_t pid = 0;
    if (player) {
        pid = player->getID();
    }
    if (!can_be_hurt(policy, pid)) {
        return false;
    }
    /*if (poke(x,y,z) != this) {
        return false;
    }*/
    // i have no resistance. take dmg directly to health
    health += dmg;
    if (health >= MAX_HEALTH) {
        health = MAX_HEALTH;
        if (can_be_destroyed(policy, pid)) {
            drop_loot(player);
            remove_self();
        }
    }
    return true;
}