Пример #1
0
 public override void loadcontent(master master)
 {
     base.textureName = "tower";
     base.loadcontent(master);
     t_weapon.loadcontent(master);
     t_weapon.location = this.geom.AABB.Position;
 }
Пример #2
0
 public override void loadcontent(master master)
 {
     base.textureName = "tower";
     base.color = Color.GreenYellow;
     base.loadcontent(master);
     geom.OnCollision += this.oncollision;
     geom.CollisionGroup = 10;
 }
Пример #3
0
 public override void loadcontent(master master)
 {
     base.textureName = "bullet";
     base.loadcontent(master);
     base.texture = master.texturebullet;
     this.geom.OnCollision += oncollide;
     this.body.LinearDragCoefficient = .00001f;
     this.body.Mass = .001f;
 }
Пример #4
0
 public override void loadcontent(master master)
 {
     //Define which type of weapon for this tower
     base.t_weapon = new w_machinegun();
     //Have the tower load itself
     base.loadcontent(master);
     //Custom values for the tower
     base.interval = 5000;
     //Custom values for the towers weapon  
 }
Пример #5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public GameplayScreen(ScreenManager screenmanager)
 {
     this.ScreenManager = screenmanager;
     TransitionOnTime = TimeSpan.FromSeconds(1.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
     game = ScreenManager.Game;
     physics = new PhysicsSimulator();
     master = new master(physics, game);            
     camera = new camera(game, (int)((float)this.game.GraphicsDevice.Viewport.Height * simplegui.gui_size));
     spritebatch = ScreenManager.SpriteBatch;
 }
Пример #6
0
 public override void loadcontent(master master)
 {
     //Create the bullet type
     //base.bulletp = new bullet();
     //Have the weapon load itself
     base.loadcontent(master);
     //Custom values for the weapon
     base.modifyfirerate(2);
     //Custom values for the bullet
     base.w_bullet.body.Mass = .01f;
     base.w_bullet.modifyShootingSpeed(1); 
 }
Пример #7
0
 public void update(GameTime gametime, master master)
 {            
     //calculate the transform matrix
     transform = math.identity *
         //translate by negative position
         math.createtranslation(-position.X, -position.Y, 0) *
         math.createscale(scale) *
         //rotate about z axis
         //math.createrotationz(1.75f) *
         //translate by the origin amount
         math.createtranslation(viewportwidth / 2, viewportheight / 2, 0);
     translate = math.identity *
         //translate by negative position
         math.createtranslation(-position.X, -position.Y, 0) *
         //rotate about z axis
         //math.createrotationz(1.75f) *
         //translate by the origin amount
         math.createtranslation(viewportwidth / 2, viewportheight / 2, 0);
     //delta so the movement seems smoooth
     float delta = (float)gametime.ElapsedGameTime.TotalSeconds;
     //get a rectangle which contains all the players
     Rectangle players = master.playerspace();
     //pad the rectangle
     players.X -= 500;
     players.Y -= 500;
     players.Width += 1000;
     players.Height += 1000;
     position = math.smoothstep(position, new Vector2(players.Center.X, players.Center.Y), movespeed); 
      
     //create a scale based on the the size of the player rectangle in respect to the original viewport size
     float xscale = viewportwidth / players.Width;
     float yscale = viewportheight/ players.Height;
     //use the largest scaling value, the smaller value scale will still include all the picture from the larger scale
     float newscale = (xscale < yscale) ? xscale : yscale;
     //clamp the scale to the min or max
     newscale = math.clamp(newscale, minscale, maxscale);
     //smooth the scaling
     scale = math.smoothstep(scale, newscale, scalespeed);
     //currently not using the rotation, but it is in there for future reference
 }
Пример #8
0
 public particleeffects(master _master)
 {
     this.master = _master;
     _particles = new Dictionary<string, ParticleEffect>();
     renderer = new SpriteBatchRenderer();
 }
Пример #9
0
 public virtual void loadcontent(master master)
 {
     this.master = master;            
     w_bullet.loadcontent(master);
 }
Пример #10
0
 public virtual void loadcontent(master master)
 {
     this.master = master;
     load(master.content);
     this.playernumber = playernumber;
 }
Пример #11
0
 public override void loadcontent(master master)
 {
     base.textureName = "player";
     shieldtexture = master.content.Load<Texture2D>("shield");
     base.loadcontent(master);
     base.playernumber = base.id.NodeID + 1;
     if (geom.OnCollision == null)
     {
         this.geom.OnCollision += this.oncollide;
     }
     
     //Load the players weapon
     pweapon.loadcontent(master);
     pweapon.playernumber = this.playernumber;
     //Load the players tower
     ptower.loadcontent(master);
     ptower.playernumber = this.playernumber;
     ptower.t_weapon.modifyfirerate(2);
     //custom physics values for the player
     body.IsQuadraticDragEnabled = true;
     body.Mass = 25;
     body.LinearDragCoefficient = body.Mass * 2f;
     body.QuadraticDragCoefficient = body.Mass * .85f;
     body.RotationalDragCoefficient = 1;            
     geom.CollisionGroup = playernumber;
     base.interval = _towerspawnrate;
     Vector2 vec0 = Vector2.Zero;
     Vector2 size = new Vector2(this.texture.Width * 3, this.texture.Height * 3);
     aabb = new AABB(ref vec0, ref size);
 }
Пример #12
0
 public simplegui(float width, float height, master master)
 {
     screen_width = width;
     screen_height = height;
     this._master = master;
 }