Exemplo n.º 1
0
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        protected override void Initialize()
        {
            base.Initialize();
            
            universe = new Universe();

            ui = new UI(GraphicsDevice, spriteBatch, window_res_x, window_res_y);
            ui.Start();
            ui.FocusUniverse(universe);

            universe.Start();
            
            universe.Update(); // this is a shitty way of making the below work
            if (universe.physicals.Count != 0)
            {
                if ((Ship)universe.physicals[0] is Ship)
                {
                    ui.FocusPhys((Ship)universe.physicals[0]);
                    //ui.GiveHumanAIHandle((IntellegenceHuman)(((Ship)universe.physicals[0]).ai));
                }
            }
            
            

        }
Exemplo n.º 2
0
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        protected override void Initialize()
        {
            base.Initialize();


            universe = new Universe();
            universe.entities.Add(new Ship());

        }
Exemplo n.º 3
0
        public void Draw(Universe universe)
        {

            device.SetRenderTarget(surface);
            device.Clear(Color.Black);
            batch.Begin();

            universe.Draw(this);

            batch.End();
        }
Exemplo n.º 4
0
        public bool HitCheck(Universe universe, Physical phys)
        {
            if (phys != parent)
            {
                Vector2 bounce;

                if ( phys.shield != null && phys.shield.active)
                {
                    ComponentShield shield = phys.shield;

                    Intersection sect = shield.hitbox.Intersect(pos);
                    if ( sect != null )
                    {
                        bounce = Utility.Bounce(velocity - phys.velocity, sect.surface_normal);
                        bounce.Normalize();

                        explosion.Explode(universe, pos, phys.velocity, bounce);
                        shield.BlockDamage(explosion.dmg, pos);
                        this.Destory();
                        return true;
                    }
                }
                else
                {
                    Intersection sect = phys.hitbox.Intersect(pos);
                    if (sect != null)
                    {
                        bounce = Utility.Bounce(velocity - phys.velocity, sect.surface_normal);
                        bounce.Normalize();

                        explosion.Explode(universe, pos, phys.velocity, bounce);
                        phys.AdsorbExplosion(explosion, pos);
                        this.Destory();
                        return true;
                    }
                }    
            }
            return false;
        }
Exemplo n.º 5
0
 public void FocusUniverse(Universe arg_universe)
 {
     focus_universe = arg_universe;
     camera_widget.universe = arg_universe;
 }
Exemplo n.º 6
0
 public Physical(Universe arg_universe) : base()
 {
     universe = arg_universe;
     
     angular_velocity = 0.0f;
 }
Exemplo n.º 7
0
        public Ship(ShipTemplate arg_template, Universe arg_universe ) : base(arg_universe)
        {
            template = arg_template;

            hitbox = template.hitbox.Copy();

            mass = template.base_mass;
            inertia = template.base_mass * template.mass_avg_radius * template.mass_avg_radius;

            radius = template.shield_radius;
            radius_sq = radius * radius;

            sprite = ArtManager.GetSpriteResource( template.hull_art_resource ).New();
           
            weapons = new ComponentWeapon[template.weapon_ports.Count];


            facade = new ShipFacade(this);
        }
Exemplo n.º 8
0
 public Ship New(Universe universe)
 {
     Ship ship = new Ship(this, universe);
     return ship;
 }
Exemplo n.º 9
0
 public void Explode(Universe universe, Vector2 pos, Vector2 velocity, Vector2 skew)
 {
     universe.AddArtTemp(art_cloud_resource.New(art_scale, pos, velocity, skew));
 }