//------------------------------------------------------------------------- bool PUSphereColliderTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node ) { PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node); PUAffector* af = static_cast<PUAffector*>(prop->parent->context); PUSphereCollider* affector = static_cast<PUSphereCollider*>(af); if (prop->name == token[TOKEN_RADIUS]) { // Property: radius if (passValidateProperty(compiler, prop, token[TOKEN_RADIUS], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setRadius(val); return true; } } } else if (prop->name == token[TOKEN_SPHERE_COLLIDER_RADIUS]) { // Property: sphere_collider_radius (Deprecated; replaced by radius) if (passValidateProperty(compiler, prop, token[TOKEN_SPHERE_COLLIDER_RADIUS], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setRadius(val); return true; } } } else if (prop->name == token[TOKEN_INNER_COLLISION]) { // Property: inner_collision if (passValidateProperty(compiler, prop, token[TOKEN_INNER_COLLISION], VAL_BOOL)) { bool val; if(getBoolean(*prop->values.front(), &val)) { affector->setInnerCollision(val); return true; } } } else { // Parse the BaseCollider PUBaseColliderTranslator baseColliderTranslator; return baseColliderTranslator.translateChildProperty(compiler, node); } return false; }
//------------------------------------------------------------------------- bool PUPlaneColliderTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node ) { PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node); PUAffector* af = static_cast<PUAffector*>(prop->parent->context); PUPlaneCollider* affector = static_cast<PUPlaneCollider*>(af); if (prop->name == token[TOKEN_NORMAL]) { // Property: normal if (passValidateProperty(compiler, prop, token[TOKEN_NORMAL], VAL_VECTOR3)) { Vec3 val; if(getVector3(prop->values.begin(), prop->values.end(), &val)) { affector->setNormal(val); return true; } } } else if (prop->name == token[TOKEN_PLANECOLL_NORMAL]) { // Property: plane_collider_normal (deprecated and replaced by 'normal') if (passValidateProperty(compiler, prop, token[TOKEN_PLANECOLL_NORMAL], VAL_VECTOR3)) { Vec3 val; if(getVector3(prop->values.begin(), prop->values.end(), &val)) { affector->setNormal(val); return true; } } } else { // Parse the BaseCollider PUBaseColliderTranslator baseColliderTranslator; return baseColliderTranslator.translateChildProperty(compiler, node); } return false; }
//------------------------------------------------------------------------- bool PUBoxColliderTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node ) { PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node); PUAffector* af = static_cast<PUAffector*>(prop->parent->context); PUBoxCollider* affector = static_cast<PUBoxCollider*>(af); if (prop->name == token[TOKEN_BOX_WIDTH]) { if (passValidateProperty(compiler, prop, token[TOKEN_BOX_WIDTH], VAL_REAL)) { // Property: box_width float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setWidth(val); return true; } } } else if (prop->name == token[TOKEN_BOXCOLL_WIDTH]) { // Property: box_collider_width (deprecated and replaced by 'box_width') if (passValidateProperty(compiler, prop, token[TOKEN_BOXCOLL_WIDTH], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setWidth(val); return true; } } } else if (prop->name == token[TOKEN_BOX_HEIGHT]) { // Property: box_height if (passValidateProperty(compiler, prop, token[TOKEN_BOX_HEIGHT], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setHeight(val); return true; } } } else if (prop->name == token[TOKEN_BOXCOLL_HEIGHT]) { // Property: box_collider_height (deprecated and replaced by 'box_height') if (passValidateProperty(compiler, prop, token[TOKEN_BOXCOLL_HEIGHT], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setHeight(val); return true; } } } else if (prop->name == token[TOKEN_BOX_DEPTH]) { // Property: box_depth if (passValidateProperty(compiler, prop, token[TOKEN_BOX_DEPTH], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setDepth(val); return true; } } } else if (prop->name == token[TOKEN_BOXCOLL_DEPTH]) { // Property: box_collider_depth (deprecated and replaced by 'box_depth') if (passValidateProperty(compiler, prop, token[TOKEN_BOXCOLL_DEPTH], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setDepth(val); return true; } } } else if (prop->name == token[TOKEN_INNER_COLLISION]) { // Property: inner_collision if (passValidateProperty(compiler, prop, token[TOKEN_INNER_COLLISION], VAL_BOOL)) { bool val; if(getBoolean(*prop->values.front(), &val)) { affector->setInnerCollision(val); return true; } } } else { // Parse the BaseCollider PUBaseColliderTranslator baseColliderTranslator; return baseColliderTranslator.translateChildProperty(compiler, node); } return false; }