Example #1
0
        public Path(Simulator simulator, ColorInterpolator color, byte alpha, BlendType blend)
        {
            Scene = simulator.Scene;
            ColorInterpolator = color;
            
            InnerPath = new Path3D();
            Times = new List<double>(MaxCurvePoints);
            Points = new List<Vector3>(MaxCurvePoints);

            for(int i = 0; i < MaxCurvePoints; i++)
            {
                Times.Add(0);
                Points.Add(Vector3.Zero);
            }

            NbPoints = 0;
            Length = 0;
            LengthBefore = 0;

            Lines = new Image[MaxVisibleLines];

            for (int i = 0; i < MaxVisibleLines; i++)
            {
                Lines[i] = new Image("LigneTrajet", Vector3.Zero)
                {
                    Blend = blend,
                    SizeX = 1.5f,
                    Alpha = alpha
                };
            }

            Active = true;
            TakeIntoAccountFakeGravTurret = false;
            TakeIntoAccountFakeGravTurretLv2 = false;
        }
Example #2
0
        public MoonPath(Simulator simulator, CelestialBody celestialBody, int alpha, string imageName, int size)
            : base(simulator, celestialBody, alpha, imageName, size)
        {
            relativePosition = new Vector3(celestialBody.Circle.Radius + Main.Random.Next(10, 30), 0, 0);

            float relativePositionY = Main.Random.Next(10, 30);

            Vector3 relativePositionInverse = relativePosition;
            relativePositionInverse.X = -relativePositionInverse.X;

            double step = RotationTime / 6;

            InnerPath = new Path3D
            (
                new List<Vector3>()
                {
                    relativePosition + new Vector3(0, -relativePositionY, 0),
                    relativePosition + new Vector3(30, 0, 0),
                    relativePosition + new Vector3(0, relativePositionY, 0),
                    relativePositionInverse + new Vector3(0, relativePositionY, 0),
                    relativePositionInverse + new Vector3(-30, 0, 0),
                    relativePositionInverse + new Vector3(0, -relativePositionY, 0),
                    relativePosition + new Vector3(0, -relativePositionY, 0)
                },
                new List<double>()
                {
                    step * 0,
                    step * 1,
                    step * 2,
                    step * 3,
                    step * 4,
                    step * 5,
                    step * 6
                }
            );

            TimeFrontStart = step * 1;
            TimeFrontEnd = step * 4;
            Representation.VisualPriority = (ActualRotationTime >= TimeFrontStart && ActualRotationTime <= TimeFrontEnd) ?
                VisualPriorities.Default.Moon :
                CelestialBody.VisualPriority + 0.01f;

            float rotation = MathHelper.ToRadians(Main.Random.Next(0, 180));

            Matrix.CreateRotationZ(rotation, out RotationMatrix);

            InnerPath.GetPosition(ActualRotationTime, ref Position);
            Vector3.Transform(ref Position, ref RotationMatrix, out Position);
            Vector3.Add(ref Position, ref CelestialBody.position, out Position);
        }
        public TeleportAnimation(Scene scene, List<Image> components, double visualPriority, Color color, bool fadeIn)
            : base(1500, visualPriority)
        {
            Scene = scene;
            Components = components;
            Color = color;
            FadeIn = fadeIn;

            FinalSize = FadeIn ? Components[0].SizeX : 0;
            OriginalSize = Components[0].SizeX;

            if (FadeIn)
            {
                foreach (var c in components)
                    c.SizeX = 0;
            }

            ShakeHorizontal = new Path3D(
                new List<Vector3>()
                {
                    Vector3.Zero,
                    new Vector3(10, 0, 0),
                    new Vector3(-10, 0, 0),
                    new Vector3(25, 0, 0),
                    new Vector3(-25, 0, 0),
                    new Vector3(10, 0, 0),
                    new Vector3(-10, 0, 0),
                    Vector3.Zero
                },
                
                new List<double>()
                {
                    0,
                    250,
                    500,
                    750,
                    1000,
                    1100,
                    1200,
                    1500
                });
        }
Example #4
0
        public static Path3D CreerVitesse(CurveType type, double time)
        {
            Path3D path = new Path3D();

            switch (type)
            {
                case CurveType.Linear:
                    path.Initialize(new List<Vector3>() { Vector3.Zero, Vector3.One }, new List<double> { 0 , time });
                    break;

                case CurveType.Exponential:
                    path.Initialize(new List<Vector3>() { Vector3.Zero, new Vector3(0.8f, 0.1f, 0.1f), Vector3.One }, new List<double> { 0, time / 2, time });
                    break;

                case CurveType.Log:
                    path.Initialize(new List<Vector3>() { Vector3.Zero, new Vector3(0.1f, 0.8f, 0.8f), Vector3.One }, new List<double> { 0, time / 2, time });
                    break;
            }

            return path;
        }