public Laser( Alien owner, Texture2D texture, Vector2 position, Vector2 launch_speed, float radius, int power ) : base(owner.m_world, texture, radius: radius, texture_name: TNames.laser) { m_buffered_linear_velocity = launch_speed; m_buffered_position = position; m_power = power; m_owner = owner; m_age = 0; }
//---------------------------------------------------------------- // Constructor //---------------------------------------------------------------- // // Creates a new AlienController with the given parameters public AlienController( GameWorld world, Alien alien, AIType type, Ninja target, float patrol_speed = ALIEN_PATROL_SPEED, float max_range = TUTORIAL_MAX_RANGE, float attack_dist = TUTORIAL_ATTACK_RANGE, float chase_dist = TUTORIAL_MAX_CHASE ) : base(ControllerType.AlienController) { m_world = world; m_self = alien; m_type = type; m_self.m_ai_type = m_type; if ( patrol_speed == 0 ) { m_self.m_move_step = ALIEN_PATROL_SPEED; } if ( max_range == 0 ) { m_self.m_range = TUTORIAL_MAX_RANGE; } if ( attack_dist == 0 ) { m_self.m_attack_dist = TUTORIAL_ATTACK_RANGE; } if ( chase_dist == 0 ) { m_self.m_chase_dist = TUTORIAL_MAX_CHASE; } m_start_rotation = alien.m_rotation; if ( alien is TwinNova ) { /*m_ai_move_step = m_self.m_move_step *= 0.75f; m_ai_range = m_self.m_range *= 1.5f; m_ai_attack_dist= m_self.m_attack_dist *= 0.75f; m_ai_chase_dist = m_self.m_chase_dist *= 1.5f; */ m_type = AIType.BOSS; } m_ai_move_step = m_self.m_move_step; m_ai_range = m_self.m_range; m_ai_attack_dist = m_self.m_attack_dist; m_ai_chase_dist = m_self.m_chase_dist; //keep in line with the multiplier from before m_ai_move_step *= 0.67f; m_target = target; m_state = State.SPAWNING; m_origin = m_self.m_buffered_position.Value; }
public Laser( Alien owner, Texture2D texture, Vector2 position, Vector2 launch_speed, int power, float rotation = 0.0f, float scale = 1.0f, float slowdown = 0.7f ) : base(owner.m_world, texture, texture_name: TNames.laser, density: 0.0001f) { m_buffered_linear_velocity = launch_speed; m_buffered_position = position; m_scale = scale; m_height = scale * m_texture.Width / GameWorld.SCALE; m_width = scale * m_texture.Height / GameWorld.SCALE; m_rotation = rotation; m_power = power; m_owner = owner; m_age = 0; m_slowdown = slowdown; m_tint = new Color( 200, 0, 150 - 150 * m_slowdown ); }
//---------------------------------------------------------------- // Methods //---------------------------------------------------------------- public override void spawn_alien() { if ( !m_disabled ) { Vector2 offset = new Vector2( (float)Math.Sin( m_rotation ), -(float)Math.Cos( m_rotation ) ) * 11; Alien alien = new Alien( m_world, TestWorld.easy_alien_texture, m_body.Position + offset, .5f, Alien.AlienType.MEDIUM, patrol_speed: 0.025f, ai: AlienController.AIType.CHASER ); alien.m_destroy_threshold = m_destroy_threshold; alien.m_kill_under_speed = m_kill_under_speed / 1.5f; alien.m_alien_color = m_alien_color; alien.m_chase_dist = m_chase_dist; alien.m_range = m_range; m_world.add_queued_object( alien ); spawn.Add( alien ); m_cooldown = max_cool; } }
public virtual void spawn_alien() { if ( !m_disabled ) { if ( m_body.Mass < 0.5 ) { m_body.Mass = 0.8f; } Alien alien = new Alien( m_world, TestWorld.easy_alien_texture, m_body.Position, .5f, Alien.AlienType.CHASER, chase_dist: m_chase_dist, patrol_speed: 0.05f, ai: AlienController.AIType.CHASER ); alien.m_range = m_range; alien.m_move_step = m_move_step; alien.m_destroy_threshold = m_destroy_threshold / 1.5f; alien.m_kill_under_speed = m_kill_under_speed; alien.m_alien_color = m_alien_color; alien.m_mass = m_body.Mass; //alien.m_alien_color = m_alien_color; //alien.m_alien_color_alpha_change = 140; m_world.add_queued_object( alien ); spawn.Add( alien ); m_cooldown = max_cool; } }
public void addAlien() { Alien adding = new Alien( screen.m_current_world, TestWorld.easy_alien_texture, getMouse(), .5f, alien.AlienType.EASY ); screen.m_current_world.add_queued_object( adding ); }