//========================================================================================= /// <summary> /// In this function each derived class should read its own data from /// the given XML node representing this object and its attributes. Base methods should /// also be called as part of this process. /// </summary> /// /// <param name="data"> /// An object representing the xml data for this XMLObject. Data values should be /// read from here. /// </param> //========================================================================================= public override void ReadXml( XmlObjectData data ) { // Call base function base.ReadXml(data); // Read all data: data.ReadString ( "SpawnObjectType" , ref m_spawn_object_type , "EnemyNinja" ); data.ReadInt ( "MinimumPhase" , ref m_mininum_phase , 0 ); // Clamp the minimum phase from 0-2: if ( m_mininum_phase < 0 ) m_mininum_phase = 0; if ( m_mininum_phase > 2 ) m_mininum_phase = 2; }
//========================================================================================= /// <summary> /// In this function each derived class should read its own data from /// the given XML node representing this object and its attributes. Base methods should /// also be called as part of this process. /// </summary> /// /// <param name="data"> /// An object representing the xml data for this XMLObject. Data values should be /// read from here. /// </param> //========================================================================================= public override void ReadXml(XmlObjectData data) { // Call base class function base.ReadXml(data); // Read all data: data.ReadEffect ( "Effect" , ref m_effect_name , ref m_effect , "Effects\\textured" ); data.ReadTexture( "CloudTexture1" , ref m_cloud_texture_1_name , ref m_cloud_texture_1 , "Graphics\\default" ); data.ReadTexture( "CloudTexture2" , ref m_cloud_texture_2_name , ref m_cloud_texture_2 , "Graphics\\default" ); data.ReadInt ( "CloudCount" , ref m_cloud_count , 16 ); data.ReadFloat ( "CloudScaleX_1" , ref m_cloud_x_scale_1 , 1 ); data.ReadFloat ( "CloudScaleY_1" , ref m_cloud_y_scale_1 , 1 ); data.ReadFloat ( "CloudScaleX_2" , ref m_cloud_x_scale_2 , 1 ); data.ReadFloat ( "CloudScaleY_2" , ref m_cloud_y_scale_2 , 1 ); data.ReadFloat ( "CloudOffsetY_1" , ref m_cloud_y_offset_1 , 0 ); data.ReadFloat ( "CloudOffsetY_2" , ref m_cloud_y_offset_2 , 0 ); data.ReadFloat ( "CloudSpeed_1" , ref m_cloud_speed_1 , 0.5f ); data.ReadFloat ( "CloudSpeed_2" , ref m_cloud_speed_2 , 0.5f ); data.ReadFloat ( "ParallaxMultiplier_1" , ref m_parallax_multiplier_1 , 0.25f ); data.ReadFloat ( "ParallaxMultiplier_2" , ref m_parallax_multiplier_2 , 0.25f ); // Create all the clouds: CreateClouds(); }
//========================================================================================= /// <summary> /// In this function each derived class should read its own data from /// the given XML node representing this object and its attributes. Base methods should /// also be called as part of this process. /// </summary> /// /// <param name="data"> /// An object representing the xml data for this XMLObject. Data values should be /// read from here. /// </param> //========================================================================================= public override void ReadXml( XmlObjectData data ) { // Call base class function base.ReadXml(data); // Read all data: data.ReadString ( "Font" , ref m_font_name , "Content\\Fonts\\Game_48px.xml" ); data.ReadFloat ( "PictureSizeX" , ref m_picture_size.X , 128 ); data.ReadFloat ( "PictureSizeY" , ref m_picture_size.Y , 128 ); data.ReadFloat ( "StringOffsetY" , ref m_string_offset_y , 0 ); data.ReadFloat ( "FadeTime" , ref m_fade_time , 0.25f ); data.ReadFloat ( "DisplayTime" , ref m_display_time , 2 ); data.ReadInt ( "StoryPartCount" , ref m_story_part_count , 1 ); // Read story data: if ( m_story_part_count > 0 ) { // Declare arrays for all the story pictures and strings: m_pictures = new Texture2D [ m_story_part_count ]; m_picture_names = new string [ m_story_part_count ]; m_story_strings = new string [ m_story_part_count ]; // Read each part of the story: the string and texture for ( int i = 0 ; i < m_story_part_count ; i++ ) { // Story part texture data.ReadTexture ( "StoryPicture" + (i+1).ToString() , ref m_picture_names[i] , ref m_pictures[i] , "Graphics\\default" ); // Story part string data.ReadString ( "StoryString" + (i+1).ToString() , ref m_story_strings[i] , "No_String" ); } } else { // No story: m_pictures = null; m_picture_names = null; m_story_strings = null; } // Read in font: m_font = new Font(m_font_name); // Fading in to current part: m_transition_state = TransitionState.SHOWING; m_current_state_time = 0; m_current_story_part = 0; }
//========================================================================================= /// <summary> /// In this function each derived class should read its own data from /// the given XML node representing this object and its attributes. Base methods should /// also be called as part of this process. /// </summary> /// /// <param name="data"> /// An object representing the xml data for this XMLObject. Data values should be /// read from here. /// </param> //========================================================================================= public override void ReadXml( XmlObjectData data ) { // Call base function base.ReadXml(data); // Read all data: data.ReadInt ( "Phase1EnemyCount" , ref m_phase1_enemy_count , 10 ); data.ReadInt ( "Phase2EnemyCount" , ref m_phase2_enemy_count , 25 ); data.ReadInt ( "Phase3EnemyCount" , ref m_phase3_enemy_count , 50 ); data.ReadInt ( "Phase4EnemyCount" , ref m_phase4_enemy_count , 75 ); data.ReadInt ( "Phase5EnemyCount" , ref m_phase5_enemy_count , 100 ); data.ReadFloat ( "Phase1SpawnInterval" , ref m_phase1_spawn_interval , 0.5f ); data.ReadFloat ( "Phase2SpawnInterval" , ref m_phase2_spawn_interval , 0.5f ); data.ReadFloat ( "Phase3SpawnInterval" , ref m_phase3_spawn_interval , 0.5f ); data.ReadFloat ( "Phase4SpawnInterval" , ref m_phase4_spawn_interval , 0.5f ); data.ReadFloat ( "Phase5SpawnInterval" , ref m_phase5_spawn_interval , 0.5f ); data.ReadInt ( "Phase1MaxActiveEnemies" , ref m_phase1_max_active_enemies , 5 ); data.ReadInt ( "Phase2MaxActiveEnemies" , ref m_phase2_max_active_enemies , 8 ); data.ReadInt ( "Phase3MaxActiveEnemies" , ref m_phase3_max_active_enemies , 10 ); data.ReadInt ( "Phase4MaxActiveEnemies" , ref m_phase4_max_active_enemies , 12 ); data.ReadInt ( "Phase5MaxActiveEnemies" , ref m_phase5_max_active_enemies , 15 ); data.ReadInt ( "CurrentPhaseEnemyKills" , ref m_current_phase_enemy_kills , 0 ); // Clamp values: if ( m_phase1_enemy_count < 1 ) m_phase1_enemy_count = 1; if ( m_phase2_enemy_count < 1 ) m_phase2_enemy_count = 1; if ( m_phase3_enemy_count < 1 ) m_phase3_enemy_count = 1; if ( m_phase4_enemy_count < 1 ) m_phase4_enemy_count = 1; if ( m_phase5_enemy_count < 1 ) m_phase5_enemy_count = 1; if ( m_current_phase_enemy_kills < 0 ) m_current_phase_enemy_kills = 0; }
//========================================================================================= /// <summary> /// In this function each derived class should read its own data from /// the given XML node representing this object and its attributes. Base methods should /// also be called as part of this process. /// </summary> /// /// <param name="data"> /// An object representing the xml data for this XMLObject. Data values should be /// read from here. /// </param> //========================================================================================= public override void ReadXml( XmlObjectData data ) { // Call base function base.ReadXml(data); // Read all data: data.ReadTexture( "Texture" , ref m_texture_name , ref m_texture , "Graphics\\default" ); data.ReadInt ( "StarCount" , ref m_star_count , 50 ); data.ReadFloat ( "StarSize1" , ref m_star_size_1 , 1.0f ); data.ReadFloat ( "StarSize2" , ref m_star_size_2 , 2.0f ); data.ReadFloat ( "StarColor1R" , ref m_star_color_1.X , 1.0f ); data.ReadFloat ( "StarColor1G" , ref m_star_color_1.Y , 1.0f ); data.ReadFloat ( "StarColor1B" , ref m_star_color_1.Z , 1.0f ); data.ReadFloat ( "StarColor1A" , ref m_star_color_1.W , 1.0f ); data.ReadFloat ( "StarColor2R" , ref m_star_color_2.X , 1.0f ); data.ReadFloat ( "StarColor2G" , ref m_star_color_2.Y , 1.0f ); data.ReadFloat ( "StarColor2B" , ref m_star_color_2.Z , 1.0f ); data.ReadFloat ( "StarColor2A" , ref m_star_color_2.W , 1.0f ); data.ReadFloat ( "ParallaxScale" , ref m_parallax_scale , 1.0f ); // Setup the stars SetupStars(); }