예제 #1
0
bool cStaticEnemy :: Editor_Rotation_Speed_Text_Changed( const CEGUI::EventArgs &event )
{
	const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
	std::string str_text = static_cast<CEGUI::Editbox *>( windowEventArgs.window )->getText().c_str();

	Set_Rotation_Speed( string_to_float( str_text ) );

	return 1;
}
예제 #2
0
void cStaticEnemy :: Init( void )
{
	m_type = TYPE_STATIC_ENEMY;
	m_pos_z = 0.094f;
	m_can_be_on_ground = 0;
	m_can_be_hit_from_shell = 0;

	m_path_state = cPath_State();
	Set_Rotation_Speed( 0.0f );
    Set_Speed( 0.0f );
	Set_Static_Image( "enemy/static/blocks/spike_1/2_grey.png" );
	Create_Name();
}
예제 #3
0
void cStaticEnemy :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
	// position
	Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
	// rotation speed
	Set_Rotation_Speed( static_cast<float>( attributes.getValueAsFloat( "rotation_speed", -7.5f ) ) );
	// image
	Set_Static_Image( attributes.getValueAsString( "image", "enemy/static/saw/default.png" ).c_str() );
    // path
    Set_Path_Identifier( attributes.getValueAsString( "path", "" ).c_str() );
    // movement speed
    Set_Speed( static_cast<float>( attributes.getValueAsFloat( "speed", m_speed ) ) );
	// fire resistant
	m_fire_resistant = attributes.getValueAsBool( "fire_resistant", m_fire_resistant );
	// ice resistance
	m_ice_resistance = static_cast<float>( attributes.getValueAsFloat( "ice_resistance", m_ice_resistance ) );
}
예제 #4
0
 void cStaticEnemy::Create_From_Stream(XMLElement* attributes)
 {
     int _posx, _posy;
     float _rotation_speed = -7.5f;
     std::string _image = "enemy/static/saw/default.png";
     std::string _path = "";
     float _speed = m_speed;
     bool _fire_resistant = m_fire_resistant;
     float _ice_resistance = m_ice_resistance;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
         
         if (!strcmp(name, "posx"))
         {
             _posx = atoi(value);
         }
         else if (!strcmp(name, "posy"))
         {
             _posy = atoi(value);
         }
         else if (!strcmp(name, "rotation_speed"))
         {
             _rotation_speed = atof(value);
         }
         else if (!strcmp(name, "image"))
         {
             _image = value;
         }
         else if (!strcmp(name, "path"))
         {
             _path = value;
         }
         else if (!strcmp(name, "speed"))
         {
             _speed = atof(value);
         }
         else if (!strcmp(name, "fire_resistatnt"))
         {
             if (value[0] == '0')
             {
                 _fire_resistant = false;
             }
             else if (value[0] == '1')
             {
                 _fire_resistant = true;
             }
         }
         else if (!strcmp(name, "ice_resistance"))
         {
             _ice_resistance = atof(value);
         }
     }
     
     Set_Pos(static_cast<float>(_posx), static_cast<float>(_posy), 1);
     Set_Rotation_Speed(static_cast<float>(_rotation_speed));
     Set_Static_Image(_image.c_str());
     Set_Path_Identifier(_path.c_str());
     Set_Speed(static_cast<float>(_speed));
     m_fire_resistant = _fire_resistant;
     m_ice_resistance = _ice_resistance;
 }