public ProtagonistsAnimation(Simulator simulator, Mothership mothership) { Simulator = simulator; Mothership = mothership; Protagonist = new SpaceshipCursor(simulator.Scene, new Vector3(-200, -600, 0), 5, VisualPriorities.Cutscenes.IntroProtagonist, new Color(95, 71, 255), "Cursor1", true); Wife = new SpaceshipCursor(Simulator.Scene, new Vector3(-200, -600, 0), 5, VisualPriorities.Cutscenes.IntroWife, new Color(255, 0, 136), "Cursor2", true); Protagonist.FadeIn(); Wife.FadeIn(); ProtagonistText = new ManualTextBubble(Simulator.Scene, new Text("I must warn the\n\nother colonies!", @"Pixelite") { SizeX = 2 }, Protagonist.Position, VisualPriorities.Cutscenes.IntroProtagonist - 0.00001) { Alpha = 0 }; State = ProtagonistState.None; TimeBeforeArrival = IntroCutscene.Timing["ProtagonistIn"]; TimeBeforeAbduction = TimeBeforeArrival + 20000; TimeBeforeGoGetHelp = TimeBeforeAbduction + 4000; TimeBeforeFireAgainAtMothership = TimeBeforeGoGetHelp + 2000; TimeBeforeGoInCenter = TimeBeforeFireAgainAtMothership + 18000; TimeBeforeWarnColonies = TimeBeforeGoInCenter + 20000; TimeBeforeTeleport = TimeBeforeWarnColonies + 10000; PathArrivalProtagonist = GetPathArrivalProtagonist(); PathArrivalWife = GetPathArrivalWife(); TimeOnPathProtaAndWife = 0; }
public AnimationTransitionAlienMothership(double length, double visualPriority) : base(length, visualPriority) { In = false; MothershipBase = new Image("MothershipBase") { Blend = BlendType.Substract, SizeX = 12 }; MothershipTentacles = new Image("MothershipTentacles") { Blend = BlendType.Substract, SizeX = 12 }; MothershipLights = new Image("MothershipLights") { Blend = BlendType.Substract, SizeX = 12 }; PathIn = new Path2D(new List<Vector2>() { PositionIn.Key, PositionIn.Value }, new List<double>() { 0, Duration }); PathOut = new Path2D(new List<Vector2>() { PositionOut.Key, PositionOut.Value }, new List<double>() { 0, Duration }); }
public static MovePathEffect FollowPath(Path2D path, double delay) { var e = MovePathEffect.Pool.Get(); e.Delay = delay; e.InnerPath = path; e.Length = path.Length; e.PointAt = true; e.Progress = Effect<IPhysical>.ProgressType.Linear; return e; }
public ShootingStar() { Shape = Shape.Circle; Circle = new Circle(Vector3.Zero, 20); ZoneImpact = 70f; LifePoints = float.MaxValue / 2; AttackPoints = float.MaxValue / 2; Positions = new List<Vector2>(3); Times = new List<double>(3); for (int i = 0; i < 3; i++) { Positions.Add(Vector2.Zero); Times.Add(0); } Path = new Path2D(); ContentLoaded = false; }
public static Path2D CreateCurve(CurveType type, double time) { Path2D path = new Path2D(); switch (type) { case CurveType.Linear: path.Initialize(new List<Vector2>() { Vector2.Zero, Vector2.One }, new List<double> { 0, time }); break; case CurveType.Exponential: path.Initialize(new List<Vector2>() { Vector2.Zero, new Vector2(0.8f, 0.1f), Vector2.One }, new List<double> { 0, time / 2, time }); break; case CurveType.Log: path.Initialize(new List<Vector2>() { Vector2.Zero, new Vector2(0.1f, 0.8f), Vector2.One }, new List<double> { 0, time / 2, time }); break; } return path; }
public static MovePathEffect MoveTextFromUpToBottom(Vector2 startingPosition, Vector2 endPosition, double timeStart, double length) { var eDt = MovePathEffect.Pool.Get(); var temps = new List<double> { 0, (random.Next(10, 40) / 100.0) * length, length }; var positions = new List<Vector2> { startingPosition, new Vector2(endPosition.X + 20, (startingPosition.Y + endPosition.Y) / 2f), endPosition }; var t = new Path2D(positions, temps); eDt.PointAt = false; eDt.StartAt = 0; eDt.InnerPath = t; eDt.Progress = Effect<IPhysical>.ProgressType.Linear; eDt.Delay = timeStart; eDt.Length = length; return eDt; }
public static List<KeyValuePair<MovePathEffect, Text>> FollowText(Text text, Path2D path, int centerDistPx, float rotationRad, bool rightToLeft) { //Separate each letter in it's own Text object List<Text> letters = new List<Text>(); for (int i = 0; i < text.Data.Length; i++) { var copy = text.Clone(); copy.Data = text.Data[i].ToString(); copy.Origin = copy.Center; letters.Add(copy); } //A letter size in time var letterSize = centerDistPx; //Create the effects List<KeyValuePair<MovePathEffect, Text>> result = new List<KeyValuePair<MovePathEffect, Text>>(); for (int i = 0; i < letters.Count; i++) { MovePathEffect mpe = MovePathEffect.Pool.Get(); if (rightToLeft) mpe.StartAt = (letters.Count - i) * letterSize; else mpe.StartAt = i * letterSize; if (rightToLeft) mpe.Length = path.Length - i * letterSize; else mpe.Length = path.Length - ((letters.Count - i) * letterSize); mpe.PointAt = true; mpe.InnerPath = path; mpe.RotationRad = rotationRad; mpe.Delay = 0; mpe.Progress = Effect<IPhysical>.ProgressType.Linear; result.Add(new KeyValuePair<MovePathEffect, Text>(mpe, letters[i])); } return result; }