Ejemplo n.º 1
0
        /// <summary>
        /// Create a new instance of a Panzer enemy tank.
        /// </summary>
        /// <param name="id">Obj id</param>
        /// <param name="content">A ContentManager to load resources with</param>
        /// <param name="position">The position of the Dart ship in the game world</param>
        public Panzer(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.position = position;
            spritesheet   = content.Load <Texture2D>("Spritesheets/newsh2.shp.000000");

            spriteBounds[(int)PanzerAimState.North].X      = 74;
            spriteBounds[(int)PanzerAimState.North].Y      = 28;
            spriteBounds[(int)PanzerAimState.North].Width  = 19;
            spriteBounds[(int)PanzerAimState.North].Height = 23;

            spriteBounds[(int)PanzerAimState.NorthEast].X      = 193;
            spriteBounds[(int)PanzerAimState.NorthEast].Y      = 58;
            spriteBounds[(int)PanzerAimState.NorthEast].Width  = 25;
            spriteBounds[(int)PanzerAimState.NorthEast].Height = 21;

            spriteBounds[(int)PanzerAimState.East].X      = 48;
            spriteBounds[(int)PanzerAimState.East].Y      = 32;
            spriteBounds[(int)PanzerAimState.East].Width  = 24;
            spriteBounds[(int)PanzerAimState.East].Height = 18;

            spriteBounds[(int)PanzerAimState.SouthEast].X      = 193;
            spriteBounds[(int)PanzerAimState.SouthEast].Y      = 89;
            spriteBounds[(int)PanzerAimState.SouthEast].Width  = 24;
            spriteBounds[(int)PanzerAimState.SouthEast].Height = 19;

            spriteBounds[(int)PanzerAimState.South].X      = 26;
            spriteBounds[(int)PanzerAimState.South].Y      = 32;
            spriteBounds[(int)PanzerAimState.South].Width  = 18;
            spriteBounds[(int)PanzerAimState.South].Height = 22;

            spriteBounds[(int)PanzerAimState.SouthWest].X      = 170;
            spriteBounds[(int)PanzerAimState.SouthWest].Y      = 88;
            spriteBounds[(int)PanzerAimState.SouthWest].Width  = 20;
            spriteBounds[(int)PanzerAimState.SouthWest].Height = 19;

            spriteBounds[(int)PanzerAimState.West].X      = 2;
            spriteBounds[(int)PanzerAimState.West].Y      = 32;
            spriteBounds[(int)PanzerAimState.West].Width  = 22;
            spriteBounds[(int)PanzerAimState.West].Height = 17;

            spriteBounds[(int)PanzerAimState.NorthWest].X      = 170;
            spriteBounds[(int)PanzerAimState.NorthWest].Y      = 58;
            spriteBounds[(int)PanzerAimState.NorthWest].Width  = 20;
            spriteBounds[(int)PanzerAimState.NorthWest].Height = 20;

            aimState = PanzerAimState.South;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Changes direction the Panzer faces relative to the Player
 /// </summary>
 /// <param name="toPlayer">Unit Vector in the direction of the Player</param>
 public void SteeringState(Vector2 toPlayer)
 {
     toPlayer.Normalize();
     if ((toPlayer.X < -0.5f) && (toPlayer.Y > 0.5f))
     {
         aimState = PanzerAimState.SouthWest;
     }
     else if ((toPlayer.X < -0.5f) && (toPlayer.Y < -0.5f))
     {
         aimState = PanzerAimState.NorthWest;
     }
     else if ((toPlayer.X > 0.5f) && (toPlayer.Y < -0.5f))
     {
         aimState = PanzerAimState.NorthEast;
     }
     else if ((toPlayer.X > 0.5f) && (toPlayer.Y > 0.5f))
     {
         aimState = PanzerAimState.SouthEast;
     }
     else if (toPlayer.X < -0.5f)
     {
         aimState = PanzerAimState.West;
     }
     else if (toPlayer.X > 0.5f)
     {
         aimState = PanzerAimState.East;
     }
     else if (toPlayer.Y < -0.5f)
     {
         aimState = PanzerAimState.North;
     }
     else
     {
         aimState = PanzerAimState.South;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new instance of a Panzer enemy tank.
        /// </summary>
        /// <param name="id">Obj id</param>
        /// <param name="content">A ContentManager to load resources with</param>
        /// <param name="position">The position of the Dart ship in the game world</param>
        public Panzer(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.position = position;
            spritesheet = content.Load<Texture2D>("Spritesheets/newsh2.shp.000000");
            bulletFired = content.Load<SoundEffect>("SFX/anti_tank_gun_single_shot");

            spriteBounds[(int)PanzerAimState.North].X = 74;
            spriteBounds[(int)PanzerAimState.North].Y = 28;
            spriteBounds[(int)PanzerAimState.North].Width = 19;
            spriteBounds[(int)PanzerAimState.North].Height = 23;

            spriteBounds[(int)PanzerAimState.NorthEast].X = 193;
            spriteBounds[(int)PanzerAimState.NorthEast].Y = 58;
            spriteBounds[(int)PanzerAimState.NorthEast].Width = 25;
            spriteBounds[(int)PanzerAimState.NorthEast].Height = 21;

            spriteBounds[(int)PanzerAimState.East].X = 48;
            spriteBounds[(int)PanzerAimState.East].Y = 32;
            spriteBounds[(int)PanzerAimState.East].Width = 24;
            spriteBounds[(int)PanzerAimState.East].Height = 18;

            spriteBounds[(int)PanzerAimState.SouthEast].X = 193;
            spriteBounds[(int)PanzerAimState.SouthEast].Y = 89;
            spriteBounds[(int)PanzerAimState.SouthEast].Width = 24;
            spriteBounds[(int)PanzerAimState.SouthEast].Height = 19;

            spriteBounds[(int)PanzerAimState.South].X = 26;
            spriteBounds[(int)PanzerAimState.South].Y = 32;
            spriteBounds[(int)PanzerAimState.South].Width = 18;
            spriteBounds[(int)PanzerAimState.South].Height = 22;

            spriteBounds[(int)PanzerAimState.SouthWest].X = 170;
            spriteBounds[(int)PanzerAimState.SouthWest].Y = 88;
            spriteBounds[(int)PanzerAimState.SouthWest].Width = 20;
            spriteBounds[(int)PanzerAimState.SouthWest].Height = 19;

            spriteBounds[(int)PanzerAimState.West].X = 2;
            spriteBounds[(int)PanzerAimState.West].Y = 32;
            spriteBounds[(int)PanzerAimState.West].Width = 22;
            spriteBounds[(int)PanzerAimState.West].Height = 17;

            spriteBounds[(int)PanzerAimState.NorthWest].X = 170;
            spriteBounds[(int)PanzerAimState.NorthWest].Y = 58;
            spriteBounds[(int)PanzerAimState.NorthWest].Width = 20;
            spriteBounds[(int)PanzerAimState.NorthWest].Height = 20;

            aimState = PanzerAimState.South;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Changes direction the Panzer faces relative to the Player
 /// </summary>
 /// <param name="toPlayer">Unit Vector in the direction of the Player</param>
 public void SteeringState(Vector2 toPlayer)
 {
     toPlayer.Normalize();
     if ((toPlayer.X < -0.5f) && (toPlayer.Y > 0.5f)) aimState = PanzerAimState.SouthWest;
     else if ((toPlayer.X < -0.5f) && (toPlayer.Y < -0.5f)) aimState = PanzerAimState.NorthWest;
     else if ((toPlayer.X > 0.5f) && (toPlayer.Y < -0.5f)) aimState = PanzerAimState.NorthEast;
     else if ((toPlayer.X > 0.5f) && (toPlayer.Y > 0.5f)) aimState = PanzerAimState.SouthEast;
     else if (toPlayer.X < -0.5f) aimState = PanzerAimState.West;
     else if (toPlayer.X > 0.5f) aimState = PanzerAimState.East;
     else if (toPlayer.Y < -0.5f) aimState = PanzerAimState.North;
     else aimState = PanzerAimState.South;
 }