public Armor( Ship arg_ship, float arg_size, ArmorTemplate arg_template)
        {
            ship = arg_ship;

            elipticity = ship.hitbox.size.X / ship.hitbox.size.Y;

            template = arg_template;
            size = arg_size;

            segment_count = ship.template.armor_segment_count;

            max_integrity = template.segment_integrity * size;
            integrity = new float[segment_count];

            for (int i = 0; i < segment_count; i++)
            {
                integrity[i] = max_integrity;
            }

            per_segment_angle = MathHelper.TwoPi / segment_count;
            start_angle = (ship.template.armor_seam_on_rear == (segment_count%2 == 0)) ? 0.0f : -per_segment_angle / 2;

            armor_resistance = template.armor_resistance * ARMOR_BASE_RESISTANCE;
            
        }
        public ComponentThruster(Ship ship, float arg_size, ThrusterTemplate arg_template) : base(ship, ship.template.component_thruster_pos, arg_size, arg_template)
        {

            template = arg_template;
            side_thrust = template.side_thrust * size;
            reverse_thrust = template.reverse_thrust * size;
            main_thrust = template.main_thrust * size;
            torque = template.torque * ship.template.mass_avg_radius * size; //template.torque * size;

            facade = new ThrusterFacade(this);

            // this needs to be dynamic
            sparkles = ArtManager.GetVentResource(template.sparkle_effects).New(0.5f);


            // I was copying particle_ports from the template, when there is no need to. Just take a pointer.
            //particle_ports = new List<ThrusterPort>();
            particle_ports = ship.template.thruster_ports;
            particle_vents = new List<ArtVent>();

            
            foreach (ThrusterPort port in ship.template.thruster_ports)
            {
                //particle_ports.Add( port.Copy() );
                ArtVent vent = ArtManager.GetVentResource(template.particle_effects).New(port.size);
                particle_vents.Add(vent);
            }
            
        }
        public Armor New( Ship ship )
        {
            Armor armor = new Armor(ship, ship.template.component_armor_size, this);
            

            return armor;
        }
Exemple #4
0
        public ShipFacade( Ship arg_ship )
        {
            hardware_updated = false;
            ship = arg_ship;

            weapons = new WeaponFacade[ship.template.weapon_ports.Count];
            for (int i = 0; i < ship.weapons.Count(); i++)
            {
                weapons[i] = new WeaponFacade(ship.template.weapon_ports[i], null);
            }
        }
        public virtual ComponentWeapon New(Ship arg_ship, WeaponPort arg_port)
        {
            float size = arg_port.size;
            ComponentWeapon weapon = new ComponentWeapon(arg_ship, arg_port, size, this);

            weapon.cooldown = 60f / (fire_rate);
            weapon.projectile_velocity = projectile_velocity;
            weapon.projectile_frame_life = (int)(projectile_range * size / projectile_velocity);
            weapon.projectile_scatter = projectile_scatter;
            weapon.projectile_scale = projectile_scale * size;

            return weapon;
        }
        public ComponentShield( Ship arg_ship, float arg_size, ShieldTemplate arg_template): base(arg_ship, arg_ship.template.component_shield_pos, arg_size, arg_template)
        {
            template = arg_template;

            radius = arg_ship.template.shield_radius;

            hitbox = new HitboxCircle(radius);
            art = ArtManager.shields[template.art_resource].New(radius, size);

            shield_resistance = template.shield_resistance * SHIELD_BASE_RESISTANCE;

            max_integrity = (arg_template.integrity * arg_size * Utility.Sqrt(arg_size));
            regen_rate = (arg_template.regen / GameConst.framerate) * arg_size;
            integrity = max_integrity;
            reform_integrity = max_integrity * template.reform_integrity;
            active = true;
        }
Exemple #7
0
        public Component( Ship arg_ship, Vector2 arg_pos, float arg_size, ComponentTemplate arg_base_template)
        {
            ship = arg_ship;

            pos = arg_pos;

            base_template = arg_base_template;
            size = arg_size;
            destroyed = false;

            max_health = base_template.health * size;
            max_power = base_template.max_power * size;
            min_power = base_template.min_power * size;

            health = max_health;
            
        }
 public ComponentShield New( Ship ship )
 {
     ComponentShield shield = new ComponentShield(ship, ship.template.component_shield_size, this);
     
     return shield;
 }
        public IntellegenceHunter( Ship arg_target )
        {
            target = arg_target;

            
            angle_tracker = new PID(10f, 0.0f, 10f);
            x_tracker = new PID(1f, 0.0f, 0.5f);
            y_tracker = new PID(1f, 0.0f, 0.5f);
            
        }
 public ComponentThruster New(Ship ship)
 {
     ComponentThruster thruster = new ComponentThruster(ship, ship.template.component_thruster_size, this);
     return thruster;
 }
        public ComponentWeapon(Ship arg_ship, WeaponPort arg_port, float arg_size, WeaponTemplate arg_template) : base(arg_ship, arg_port.position, arg_size, arg_template)
        {
            port = arg_port;
            template = arg_template;
            
            explosion = template.explosion * size;

            facade = new WeaponFacade(port, this);
        }
Exemple #12
0
 public Ship New(Universe universe)
 {
     Ship ship = new Ship(this, universe);
     return ship;
 }