void MoveMothership() { bool shouldMove = false; if (!transform.position.x.Equals(anchorX)) { shouldMove = true; } else if (!transform.position.y.Equals(anchorY)) { shouldMove = true; } else { state = MothershipState.Normal; } if (shouldMove) { Vector3 movement = new Vector3(anchorX - transform.position.x, anchorY - transform.position.y, 0f); if (movement.magnitude > returnSpeed) { movement.Normalize(); movement *= returnSpeed; } transform.Translate(movement); } }
public MothershipAnimation(Simulator simulator) { Simulator = simulator; Mothership = new Mothership(Simulator, VisualPriorities.Cutscenes.IntroMothership) { Direction = new Vector3(0, -1, 0), ShowShield = true, ShieldImageName = "MothershipHitMask", ShieldColor = Colors.Default.AlienBright, ShieldAlpha = 100, ShieldDistance = 10 }; Mothership.Position = new Vector3(0, -Mothership.Size.Y/2 - 360, 0); Simulator.AddSpaceship(Mothership); State = MothershipState.None; Simulator.Scene.Camera.Zoom = 1f; }
// Use this for initialization void Start() { state = MothershipState.Normal; }
public void Update() { TimeBeforeArrival -= Preferences.TargetElapsedTimeMs; TimeBeforeLights -= Preferences.TargetElapsedTimeMs; TimeBeforeDestruction -= Preferences.TargetElapsedTimeMs; TimeBeforeDeparture -= Preferences.TargetElapsedTimeMs; switch (State) { case MothershipState.None: if (TimeBeforeArrival <= 0) { Simulator.Scene.PhysicalEffects.Add(Mothership, Core.Physics.PhysicalEffects.Move(new Vector3(0, -Mothership.Size.Y / 2, 0), 0, TimeArrival)); Simulator.Scene.VisualEffects.Add(Simulator.Scene.Camera, Core.Visual.VisualEffects.ChangeSize(1f, ArrivalZoom, 0, TimeArrival)); foreach (var player in Inputs.Players) { //Inputs.VibrateControllerHighFrequency(player, TimeArrival, 0.1f); Inputs.VibrateControllerLowFrequency(player, TimeArrival, 0.4f); } State = MothershipState.Arrival; } break; case MothershipState.Arrival: if (TimeBeforeLights < 0) { Mothership.ActivateDeadlyLights(Simulator.Scene, TimeLights); State = MothershipState.Lights; } break; case MothershipState.Lights: if (TimeBeforeDestruction < 0) { if (CelestialBodies != null) Mothership.DestroyEverything(Simulator.Scene, CelestialBodies); if (Battleships != null) Mothership.DestroyEverything(Simulator.Scene, Battleships); State = MothershipState.Destruction; } break; case MothershipState.Destruction: if (TimeBeforeDeparture < 0) { Mothership.DeactivateDeadlyLights(Simulator.Scene, TimeDeparture / 6); Mothership.CoverInvasionShips(Simulator.Scene, TimeDeparture / 4); Simulator.Scene.PhysicalEffects.Add(Mothership, Core.Physics.PhysicalEffects.Move(new Vector3(0, Mothership.Position.Y + 5000, 0), 0, TimeDeparture)); Simulator.Scene.VisualEffects.Add(Simulator.Scene.Camera, Core.Visual.VisualEffects.ChangeSize(ArrivalZoom, DepartureZoom, TimeDeparture / 6, TimeDeparture)); foreach (var player in Inputs.Players) { //Inputs.VibrateControllerHighFrequency(player, TimeDeparture / 3, 0.1f); Inputs.VibrateControllerLowFrequency(player, TimeDeparture / 3, 0.4f); } State = MothershipState.Departure; } break; case MothershipState.Departure: break; } Mothership.Update(); }