public void AddImage(GameObject gameObject) { // If the object is large enough, just add a smaller copy to the sensors screen if (gameObject.Bounds.Width > 80 || gameObject.Bounds.Height > 150) { Image sensorImage; if (gameObject.Data != null) { sensorImage = new Image( gameObject.Data.TextureAsset, gameObject.Position / (Camera2D.BackgroundMultiplier), new Vector2(1 / Camera2D.BackgroundMultiplier, 1 / Camera2D.BackgroundMultiplier), gameObject.Data.Name, gameObject.Rotation); sensorImage.SetHoverInfoText(sensorImage.Name); } else { string[] strings = gameObject.DataAsset.Split('/'); sensorImage = new Image( gameObject.DataAsset, gameObject.Position / (Camera2D.BackgroundMultiplier), new Vector2(1 / Camera2D.BackgroundMultiplier, 1 / Camera2D.BackgroundMultiplier), strings.Last(), gameObject.Rotation); } sensorImage.SetTexture(gameObject.Texture); SensorImages.Add(gameObject, sensorImage); AddScreenUIElement(sensorImage); } else { string imageAsset = "Object"; if (gameObject as EnemyShip != null) { imageAsset = "Enemy"; } else if (gameObject as PlayerShip != null) { imageAsset = "Player"; } Image sensorImage = new Image( "", ScreenManager.ScreenCentre + gameObject.Position / (Camera2D.BackgroundMultiplier), "Sensor Image"); if (gameObject.Data != null) { sensorImage.SetHoverInfoText(gameObject.Data.Name); } sensorImage.SetTexture(Thumbnails[imageAsset]); AddScreenUIElement(sensorImage); SensorImages.Add(gameObject, sensorImage); } }
public override void AddGameObjects() { GameObject spaceStation = new GameObject("Sprites/Space Objects/Space Stations/LargeSpaceStation", new Vector2(ScreenManager.Viewport.Width / 2, ScreenManager.Viewport.Height / 2)); AddGameObjectEvent(0, spaceStation); PlayerShip playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Barracuda", ScreenManager.ScreenCentre + new Vector2(0, 500)); playerShip.AutoTurrets = true; playerShip.ManualSteering = false; AddGameObjectEvent(0, playerShip); }
public Engine(string dataAsset, GameObject parentGameObject, Vector2 engineHardPoint) : base(dataAsset, parentGameObject.Position + engineHardPoint) { ParentGameObject = parentGameObject; EngineHardPoint = engineHardPoint; ActiveSmoke = new List<AnimatedGameObject>(); SmokeToAdd = new List<AnimatedGameObject>(); SmokeToRemove = new List<AnimatedGameObject>(); }
// Set the object to focus private void SetFocusedObject(GameObject gameObject) { FocusedObject = gameObject; }
// Used for focusing and following a specific game object public void SetCameraToFocusOnObject(GameObject gameObject) { CameraType = CameraType.Focused; SetFocusedObject(gameObject); }
public bool IsVisible(GameObject gameObject) { if (ViewRectangle.Intersects(gameObject.Bounds)) { return true; } else { return false; } }
public void AddRotationEvent(float activationTime, GameObject objectToMove, float rotation) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Rotate GameObject", activationTime); eventArgs.MoveSpeed = rotation; eventArgs.GameObject = objectToMove; EventsList.Add(eventArgs); }
public virtual void AddRemoveGameObjectEvent(float activationTime, GameObject gameObject) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Add GameObject", activationTime); eventArgs.GameObject = gameObject; EventsList.Add(eventArgs); }
public override void AddGameObjects() { PlayerShip playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Barracuda", new Vector2(ScreenManager.Viewport.Width / 2, 2000)); AddGameObjectEvent(0, playerShip); AddMoveEvent(1, playerShip, new Vector2(playerShip.Position.X, 1400)); AddMoveEvent(17, playerShip, new Vector2(playerShip.Position.X, ScreenManager.Viewport.Height / 2 + 500)); ScreenManager.Camera.SetPosition(playerShip.Position); GameObject spaceStation = new GameObject("Sprites/Space Objects/Space Stations/LargeSpaceStation", new Vector2(ScreenManager.Viewport.Width / 2, ScreenManager.Viewport.Height / 2)); AddGameObjectEvent(1, spaceStation); for (int i = 0; i < 3; i++) { playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Dragonfly", new Vector2(200 * (i + 1) + ScreenManager.Viewport.Width / 2, 2300)); AddGameObjectEvent(0, playerShip); AddMoveEvent(0, playerShip, new Vector2(playerShip.Position.X, 1300)); AddMoveEvent(49, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); AddRemoveGameObjectEvent(55, playerShip); } for (int i = 0; i < 5; i++) { playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Hurricane", new Vector2(150 * (2 - i) + ScreenManager.Viewport.Width / 2, 2000)); AddGameObjectEvent(10, playerShip); AddMoveEvent(10, playerShip, new Vector2(80, 500 + 100 * (2 - i))); AddMoveEvent(51, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); AddRemoveGameObjectEvent(57, playerShip); } for (int i = 0; i < 5; i++) { playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Tornado", new Vector2(150 * (2 - i) + ScreenManager.Viewport.Width / 2, 2000)); AddGameObjectEvent(20, playerShip); AddMoveEvent(20, playerShip, new Vector2(ScreenManager.Viewport.Width - 100, 500 + 100 * (2 - i))); AddMoveEvent(53, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); AddRemoveGameObjectEvent(63, playerShip); } for (int i = 0; i < 3; i++) { playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Tsunami", new Vector2(-100 * (i + 1) + ScreenManager.Viewport.Width / 2, 2000)); AddGameObjectEvent(30, playerShip); AddMoveEvent(30, playerShip, new Vector2(playerShip.Position.X, 30)); AddMoveEvent(55, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); AddRemoveGameObjectEvent(59, playerShip); } playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Austria", new Vector2(ScreenManager.Viewport.Width / 2 - 500, ScreenManager.Viewport.Height / 2)); playerShip.SetRotation(3 * MathHelper.PiOver2); AddGameObjectEvent(0, playerShip); AddMoveEvent(60, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Austria", new Vector2(ScreenManager.Viewport.Width / 2 + 500, ScreenManager.Viewport.Height / 2)); playerShip.SetRotation(MathHelper.PiOver2); AddGameObjectEvent(0, playerShip); AddMoveEvent(60, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); float rootTwoRecip = (float)Math.Sin(MathHelper.PiOver4); playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Eagle", new Vector2(ScreenManager.Viewport.Width / 2 - 450 * rootTwoRecip, ScreenManager.Viewport.Height / 2 + 450 * rootTwoRecip)); playerShip.SetRotation(7 * MathHelper.PiOver4); AddGameObjectEvent(0, playerShip); AddMoveEvent(65, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Eagle", new Vector2(ScreenManager.Viewport.Width / 2 + 450 * rootTwoRecip, ScreenManager.Viewport.Height / 2 + 450 * rootTwoRecip)); playerShip.SetRotation(MathHelper.PiOver4); AddGameObjectEvent(0, playerShip); AddMoveEvent(65, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Hawk", new Vector2(ScreenManager.Viewport.Width / 2 - 450 * rootTwoRecip, ScreenManager.Viewport.Height / 2 - 450 * rootTwoRecip)); playerShip.SetRotation(5 * MathHelper.PiOver4); AddGameObjectEvent(0, playerShip); AddMoveEvent(70, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); playerShip = new PlayerShip("XML/Cut Scenes/Ships/UIN Ships/Hawk", new Vector2(ScreenManager.Viewport.Width / 2 + 450 * rootTwoRecip, ScreenManager.Viewport.Height / 2 - 450 * rootTwoRecip)); playerShip.SetRotation(3 * MathHelper.PiOver4); AddGameObjectEvent(0, playerShip); AddMoveEvent(70, playerShip, new Vector2(-200, ScreenManager.Viewport.Height / 2)); }
private void AddSensorMarker(GameObject gameObject, Texture2D markerImage) { Vector2 sensorPosition = CalculateSensorPosition(gameObject); Image marker = new Image(SensorsUIData.EnemyMarkerAsset, sensorPosition, "Enemy Marker", gameObject.Rotation); marker.SetTexture(markerImage); LoadAndAddUIElement(marker, marker.Position); }
public void RemoveImage(GameObject gameObject) { SensorImagesToRemove.Add(gameObject, SensorImages[gameObject]); }
public bool RemoveGameObject(GameObject gameObject) { if (GameObjects.Contains(gameObject)) { GameObjectsToRemove.Add(gameObject); return true; } return false; }
public void LoadAndAddGameObject(GameObject gameObject) { gameObject.LoadContent(ScreenManager.Content); GameObjectsToAdd.Add(gameObject); }
public void AddGameObject(GameObject gameObject) { GameObjectsToAdd.Add(gameObject); }
public Sensor(string dataAsset, GameObject parentGameObject) : base(dataAsset, parentGameObject.Position) { ParentGameObject = parentGameObject; RangeMultiplier = 1; }
public void SetTarget(GameObject target) { TargetShip = target; }
public override void AddGameObjectEvent(float activationTime, GameObject gameObject) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Add GameObject", activationTime); gameObject.LoadContent(ScreenManager.Content); eventArgs.GameObject = gameObject; Ship ship = gameObject as Ship; if (ship != null) { ship.SetUpTurretSpawnPools(); eventArgs.GameObject = ship; } EventsList.Add(eventArgs); }
public virtual void AddGameObjectEvent(float activationTime, GameObject gameObject) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Add GameObject", activationTime); eventArgs.GameObject = gameObject; eventArgs.GameObject.LoadContent(ScreenManager.Content); EventsList.Add(eventArgs); }
private Vector2 CalculateSensorPosition(GameObject gameObject) { float tempSensPosX = (gameObject.Position.X + Camera.Position.X - ScreenManager.ScreenCentre.X) / (float)Range; float tempSensPosY = (gameObject.Position.Y + Camera.Position.Y - ScreenManager.ScreenCentre.Y) / (float)Range; tempSensPosX = MathHelper.Clamp(tempSensPosX, -1, 1); tempSensPosY = MathHelper.Clamp(tempSensPosY, -1, 1); return new Vector2(Dimensions.X * tempSensPosX / 2, Dimensions.Y * tempSensPosY / 2); }
public void AddMoveEvent(float activationTime, GameObject objectToMove, Vector2 position) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Move GameObject", activationTime); eventArgs.MoveDestination = position; eventArgs.GameObject = objectToMove; EventsList.Add(eventArgs); }