/// <summary> /// Constructor for the GPE /// </summary> /// <param name="a_world">World for the GPE to exist in</param> /// <param name="a_gameState">gamestate to manage the gravity of</param> /// <param name="a_texture">texture for the gravity bar</param> /// <param name="a_camera">camera that provides the viewport to draw in</param> /// <param name="a_player">player that handles the gravity bar</param> public GPE(World a_world, GameState a_gameState, Texture2D a_texture, Camera a_camera, Player a_player) { m_camera = a_camera; m_gameState = a_gameState; m_bar = new Sprite(a_world, a_texture, new Vector2(450, 40), 0, m_camera.Position + new Vector2(0, 200)); m_bar.m_body.BodyType = BodyType.Static; m_barBackground = new Sprite(a_world, a_texture, new Vector2(450, 40), 0, m_camera.Position + new Vector2(0, 200)); m_barBackground.m_body.BodyType = BodyType.Static; m_bar.m_body.CollisionCategories = Category.None; m_barBackground.m_body.CollisionCategories = Category.None; m_player = a_player; }
/// <summary> /// Constructor for the Turret class /// </summary> /// <param name="a_world">World for the turret to exist in</param> /// <param name="a_topTexture">Texture for the top of the turret</param> /// <param name="a_baseTexture">Texture for the base of the turret</param> /// <param name="a_bulletTexture">Texture for the bullet</param> /// <param name="a_position">Position to create the turret at !(warning, turret draws from centre of base)!</param> /// <param name="a_player">Target for the turret to follow</param> /// <param name="a_rotation">Initial rotation for the turret</param> public Turret( PlayingGameState a_state, Texture2D a_topTexture, Texture2D a_baseTexture, Texture2D a_bulletTexture, Vector2 a_position, Player a_player, float a_rotation) { Vector2 tempRot = new Vector2(-(float)Math.Sin(a_rotation), (float)Math.Cos(a_rotation)); m_bulletTexture = a_bulletTexture; m_state = a_state; m_base = new Sprite( m_state.m_world, a_baseTexture, new Vector2(80, 40), 50, a_position); m_base.m_body.BodyType = BodyType.Static; m_base.m_body.Rotation = (float)(Math.Atan2(tempRot.Y, tempRot.X) - (Math.PI / 2)); m_top = new Sprite( m_state.m_world, a_topTexture, 15, 50, m_base.Position + (tempRot * 15)); m_top.m_body.BodyType = BodyType.Static; m_angle = new Vector2(-1, 0); m_player = a_player; m_cooldown = 0; }
/// <summary> /// Constructor for the turret class, passing in a platform for level editing purposes /// </summary> /// <param name="a_state">World for the turret to exist in</param> /// <param name="a_topTexture">Texture for the top of the turret</param> /// <param name="a_baseTexture">Texture for the base of the turret</param> /// <param name="a_bulletTexture">Texture for the bullet</param> /// <param name="a_platform">Platform provides position and rotation to create the turret</param> /// <param name="a_player">Target for the turret to follow</param> public Turret( PlayingGameState a_state, Texture2D a_topTexture, Texture2D a_baseTexture, Texture2D a_bulletTexture, Platform a_platform, Player a_player) { m_bulletTexture = a_bulletTexture; m_state = a_state; Vector2 tempRot = new Vector2(-(float)Math.Sin(a_platform.m_sprite.m_body.Rotation - (Math.PI)), (float)Math.Cos(a_platform.m_sprite.m_body.Rotation - (Math.PI))); m_base = new Sprite( m_state.m_world, a_baseTexture, new Vector2(80, 40), 50, a_platform.m_sprite.Position + (tempRot * 26)); m_base.m_body.BodyType = BodyType.Static; m_base.m_body.Rotation = a_platform.m_sprite.m_body.Rotation - (float)(Math.PI); m_top = new Sprite( m_state.m_world, a_topTexture, 15, 50, m_base.Position + (tempRot * 15)); m_top.m_body.BodyType = BodyType.Static; m_angle = new Vector2(-1, 0); m_player = a_player; m_cooldown = 0; }