public override bool AddGameObject(CutSceneEventArgs eventArgs) { bool added = base.AddGameObject(eventArgs); if (added) { Ship ship = eventArgs.GameObject as Ship; if (ship != null) { PlayerShip playerShip = ship as PlayerShip; EnemyShip enemyShip = ship as EnemyShip; if (playerShip != null) { PlayerShips.Add(playerShip); } else if (enemyShip != null) { EnemyShips.Add(enemyShip); } } } return added; }
public virtual bool RemoveGameObject(CutSceneEventArgs eventArgs) { if (eventArgs.ObjectName != null) { GameObject gameObject = GetGameObject(eventArgs.ObjectName); if (gameObject != null) { gameObject.Die(); } } else if (eventArgs.GameObject != null) { GameObjects.Remove(eventArgs.GameObject); } return true; }
public virtual bool MoveCamera(CutSceneEventArgs eventArgs) { ScreenManager.Camera.MoveToDestination(eventArgs.MoveDestination, eventArgs.MoveSpeed); if (ScreenManager.Camera.CameraType == CameraType.MovingToPoint) { return false; } else { ScreenManager.Camera.SetFixedScreenCamera(false); return true; } }
public virtual bool Move(CutSceneEventArgs eventArgs) { return true; }
public virtual bool LoadNextScreen(CutSceneEventArgs eventArgs) { if (NextScreen != null) { ScreenManager.LoadAndAddScreen(NextScreen); Die(); } return true; }
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 bool AddDialogBox(CutSceneEventArgs eventArgs) { DialogBox dialogBox = new DialogBox( "Sprites/UI/Panels/Panel", eventArgs.ObjectName, eventArgs.MoveDestination, new Vector2(ScreenManager.Viewport.Width / 3, ScreenManager.Viewport.Height / 8), new Color(0, 0.1f, 0, 0), "Dialog Box", 0.5f, eventArgs.MoveSpeed); AddScreenUIElement(dialogBox); return true; }
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); }
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); }
public void AddLoadNextScreenEvent(float activationTime) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Load Next Screen", activationTime); EventsList.Add(eventArgs); }
public virtual bool AddGameObject(CutSceneEventArgs eventArgs) { if (eventArgs.GameObject != null) { AddGameObject(eventArgs.GameObject); } return true; }
public void AddDialogBoxEvent(float activationTime, string text, Vector2 position, float lifeTimer = 6f) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Add Dialog Box", activationTime); eventArgs.ObjectName = text; eventArgs.MoveSpeed = lifeTimer; eventArgs.MoveDestination = position; EventsList.Add(eventArgs); }
public void AddDialogBoxEvent(float activationTime, string text, float lifeTimer = 6f) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Add Dialog Box", activationTime); eventArgs.ObjectName = text; eventArgs.MoveSpeed = lifeTimer; eventArgs.MoveDestination = new Vector2(ScreenManager.Viewport.Width / 4, ScreenManager.Viewport.Height / 2); EventsList.Add(eventArgs); }
public virtual bool Rotate(CutSceneEventArgs eventArgs) { if (eventArgs.GameObject != null) { Vector2 difference = new Vector2((float)Math.Sin(eventArgs.MoveSpeed), -(float)Math.Cos(eventArgs.MoveSpeed)); float desiredAngle = (float)Math.Atan2(difference.X, -difference.Y); desiredAngle %= (float)MathHelper.Pi; // Rotates to desired angle if (Math.Abs(desiredAngle - eventArgs.GameObject.Rotation) < 2 * 0.01f) { eventArgs.GameObject.SetRotation(desiredAngle); return true; } else { // Velocity = Vector2.Zero; // Change the coordinates so we always assume rotation is 0 // Only interested in the offset between desiredAngle and Rotation to work out which way to go float zeroedDesiredAngle = desiredAngle - eventArgs.GameObject.Rotation; if (zeroedDesiredAngle < -MathHelper.Pi) { zeroedDesiredAngle += MathHelper.TwoPi; } if (zeroedDesiredAngle > MathHelper.Pi) { zeroedDesiredAngle -= MathHelper.Pi; } if (zeroedDesiredAngle > 0) { eventArgs.GameObject.SetRotation(eventArgs.GameObject.Rotation + 0.01f); } else { eventArgs.GameObject.SetRotation(eventArgs.GameObject.Rotation - 0.01f); } // Make sure Rotation is in the bounds -Pi to Pi for comparison with the desiredAngle above if (eventArgs.GameObject.Rotation > MathHelper.Pi) { eventArgs.GameObject.SetRotation(eventArgs.GameObject.Rotation - MathHelper.TwoPi); } if (eventArgs.GameObject.Rotation < -MathHelper.Pi) { eventArgs.GameObject.SetRotation(eventArgs.GameObject.Rotation + MathHelper.TwoPi); } return false; } } return true; }
public virtual void AddRemoveGameObjectEvent(float activationTime, GameObject gameObject) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Add GameObject", activationTime); eventArgs.GameObject = gameObject; EventsList.Add(eventArgs); }
public override bool Move(CutSceneEventArgs eventArgs) { if (eventArgs.ObjectName != null) { Ship ship = (Ship)GetGameObject(eventArgs.ObjectName); if (ship != null) { ship.SetDestination(eventArgs.MoveDestination); } } else if (eventArgs.GameObject != null) { Ship ship = (Ship)eventArgs.GameObject; if (ship != null) { ship.SetDestination(eventArgs.MoveDestination); } } return true; }
public virtual void AddRemoveGameObjectEvent(float activationTime, string gameObjectName) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Add GameObject", activationTime); eventArgs.ObjectName = gameObjectName; EventsList.Add(eventArgs); }
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 void AddCameraMoveEvent(float activationTime, Vector2 position, float moveSpeed = 3f) { CutSceneEventArgs eventArgs = new CutSceneEventArgs("Move Camera", activationTime); eventArgs.MoveDestination = position; eventArgs.MoveSpeed = moveSpeed; EventsList.Add(eventArgs); }