Example #1
0
 public A3DLoopAround(Drawable3D parent, FlightStats stats, bool goingUp, int lifetime)
     : base(parent, lifetime)
 {
     incrementPitch = 360.0f / (float)lifetime;
     if (!goingUp)
     {
         incrementPitch *= -1;
     }
 }
Example #2
0
 public A3DTurnWithLean(Drawable3D parent, int lifetime, float rotationAmount, float rollAmount)
     :       base(parent, lifetime)
 {
     incrementRotation = rotationAmount / lifetime;
     incrementRoll     = rollAmount / lifetime;
     maxRotation       = rotationAmount;
     maxRoll           = rollAmount;
     halfwayDone       = lifetime / 2;
 }
Example #3
0
 public A3DPositionPercentageCheck(Drawable3D parent, LocationCheckType type, float percentage)
     : base(parent)
 {
     this.OnEveryUpdate += (GameTime g) =>
     {
         if (ScreenBounds.IsPositionPastPercentage(type, percentage, parentDrawable.Transform.Position))
         {
             this.Kill();
         }
     };
 }
Example #4
0
 public A3DBarrelRoll(Drawable3D parent, int fullRotateTime, int numberOfRotations)
     : base(parent, fullRotateTime * numberOfRotations)
 {
     incrementRoll      = 360.0f / (float)fullRotateTime;
     this.AliveChanged += (Action a) =>
     {
         if (!a.IsAlive)
         {
             parent.Transform.FlattenRoll();
         }
     };
 }
Example #5
0
        public A3DAttachToBone(Drawable3D parent, ICollidable target, String bonename, int lifetime = 0)
            : base(parent, lifetime)
        {
            targetDrawable = target;
            boneName       = bonename;

            int count = targetDrawable.Mesh().MainModel.Bones.Count;

            for (int i = 0; i < count; i++)
            {
                if (targetDrawable.Mesh().MainModel.Bones[i].Name == boneName)
                {
                    bone = targetDrawable.Mesh().MainModel.Bones[i];
                }
            }
        }
Example #6
0
        public A3DFollow(Drawable3D parent, FlightStats flightstats, int numtargets, int lifetime = 0)
            : base(parent, lifetime)
        {
            parentDrawable.Actions.Attach(new A3DFlyStraight(parent, flightstats, false));
            turnToTargetAction = new A3DTurnToTarget(parent, target);
            parentDrawable.Actions.Attach(turnToTargetAction);
            maxTargets = numtargets;

            GetNextTarget();

            //KeyValueDisplay.Instance.Add("Target",
            //    delegate()
            //    {
            //        return (Object)enemy.Name;
            //    }
            //);
        }
Example #7
0
 public A3DFlyDown(Drawable3D parent, FlightStats stats, bool resetSpeed, int lifetime = 0)
     : base(parent, lifetime)
 {
     this.flightStats = stats;
     this.resetSpeedBeforeApplying = resetSpeed;
 }
Example #8
0
 public A3DPopup(Drawable3D parent, int targetHeight, int lifetime, int startHeight = -9999)
     : base(parent, lifetime)
 {
     this.targetHeight = targetHeight;
     this.startHeight  = startHeight;
 }
Example #9
0
 public A3DMeshTemporaryTint(Drawable3D parent, StaticMesh parentMesh, int lifetime, Color color)
     : base(parent, lifetime)
 {
     this.parentMesh = parentMesh;
     this.tintColor  = color;
 }
Example #10
0
 public A3DSpin(Drawable3D parent, Vector3 speed, int lifetime = 0)
     : base(parent, lifetime)
 {
     this.rotation = speed;
 }
Example #11
0
 public A3DAdjustPitch(Drawable3D parent, int lifetime, float amount)
     : base(parent, lifetime)
 {
     incrementAmount = amount / (float)lifetime;
 }
Example #12
0
 /// <summary>
 /// Instantiates a new event argument with the specified drawable.
 /// </summary>
 /// <param name="drawable">The drawable of this event.</param>
 public SelectedDrawableChangedEventArgs(Drawable3D drawable)
 {
     this.Drawable = drawable;
 }
Example #13
0
 public A3DFlyIntoView(Drawable3D parent, FlightStats stats, int fly = 90)
     : base(parent, stats, false)
 {
     flyPercentage = fly;
 }
Example #14
0
 public void AddObject(Drawable3D Object)
 {
     objects.Add(Object);
     Items.Add(Object.ToString());
     Items[Items.Count - 1].Checked = true;
 }
Example #15
0
        public override void Reset()
        {
            base.Reset();

            Add(render3DContainer = new Render3DContainer
            {
                RelativeSizeAxes = Axes.Both,
                BackgroundColour = Color4.White.Scale(0.01f),
                Children         = new Drawable3D[]
                {
                    new Sprite3D
                    {
                        Colour       = Color4.HotPink,
                        Texture      = testTexture,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(0.0f, 0.0f, 0.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Right, MathHelper.PiOver2)
                    },
                    particleSystem = new ParticleSystem()
                    {
                        EmissionRate        = 300.0f,
                        MaximumParticles    = 1000,
                        Texture             = testTexture,
                        BlendingMode        = BlendingMode.Mixture,
                        Position            = new Vector3(0.0f, 0.0f, 0.0f),
                        Rotation            = Quaternion.FromAxisAngle(Vector3.Right, -MathHelper.PiOver2), // Facing up
                        VelocityInitializer = new ConeVelocityInitializer {
                            Angle = MathHelper.Pi * 0.4f, MinimumVelocity = 1.0f, MaximumVelocity = 3.0f
                        },
                        RotationInitializer = new RotationInitializer {
                            Minimum = 0.0f, Maximum = MathHelper.Pi
                        },
                        SizeInitializer = new SizeInitializer {
                            MaximumUniform = 0.6f, MinimumUniform = 0.4f
                        },
                        ColourInitializer = new ColourInitializer(Color4.AliceBlue.WithAlpha(0.6f)),
                        ParticleUpdaters  = new Updater[]
                        {
                            new ConstantRotationSpeed(),
                            new VelocityDecay(),
                        },
                        ComputedProperties = new ComputedProperty[]
                        {
                            new AlphaFade(),
                            new SizeFade {
                                Easing = EasingTypes.None, End = 1.0f, Start = 0.2f
                            }
                        },
                        TransparencyGroup = 3
                    },
                    cameraBoom = new Node
                    {
                        Children = new Drawable3D[]
                        {
                            new Camera()
                            {
                                Position = new Vector3(0.0f, 0.0f, 5.0f)
                            }
                        }
                    }
                }
            });

            cameraRotation = new Vector3(-20.0f, -45.0f, 0.0f);
            UpdateCamera();

            animation = Scheduler.AddDelayed(() =>
            {
                double phase            = Time.Current / 1000.0 * 2.0f;
                particleSystem.Position = new Vector3((float)Math.Cos(phase), 0.0f, (float)Math.Sin(phase)) * 2.0f;
            }, 10.0, true);
        }
Example #16
0
 public A3DTurnToTarget(Drawable3D parent, Drawable3D target, int lifetime = 0)
     : base(parent, lifetime)
 {
     drawTarget = target;
 }
Example #17
0
 public A3DGrow(Drawable3D parent, float rate, int lifetime = 0)
     : base(parent, lifetime)
 {
     scaleRate = new Vector3(rate, rate, rate);
 }
Example #18
0
 public A3DHover(Drawable3D parent, int lifetime, float distance, int cycleMS)
     :       base(parent, lifetime)
 {
     maxHover       = distance;
     hoverIncrement = (distance * 2) / (float)cycleMS;
 }
Example #19
0
 public A3DSpin(Drawable3D parent, float min, float max)
     : base(parent)
 {
     this.rotation = new Vector3(Game1.RandomFloat(min, max), Game1.RandomFloat(min, max), Game1.RandomFloat(min, max));
 }
Example #20
0
 public A3DTranslate(Drawable3D parent, Vector3 targetPosition, int lifetime)
     : base(parent, lifetime)
 {
     this.targetPosition = targetPosition;
 }
Example #21
0
 public A3DKillBelowTerrain(Drawable3D parent)
     : base(parent, 0)
 {
 }
Example #22
0
 /// <summary>
 /// Instantiates a new HitTestResult instance on the specified Drawable with the
 /// specified hit point.
 /// </summary>
 /// <param name="drawable">The hit Drawable.</param>
 /// <param name="hitPoint">The point of hit.</param>
 public HitTestResult(Drawable3D drawable, Vector3d hitPoint)
 {
     this.Drawable = drawable;
     this.HitPoint = hitPoint;
 }
Example #23
0
 public void AddObject(Drawable3D Object)
 {
     objects.Add(Object);
     Items.Add(Object.ToString());
 }
Example #24
0
 public Action3D(Drawable3D parent, int lifetime = 0)
     : base(lifetime)
 {
     this.parentDrawable = parent;
 }
Example #25
0
File: Test3D.cs Project: guusw/fx2
        public override void Reset()
        {
            base.Reset();

            Sprite3D billboardRoot;

            Add(render3DContainer = new Render3DContainer
            {
                RelativeSizeAxes = Axes.Both,
                BackgroundColour = Color4.White.Scale(0.01f),
                Children         = new Drawable3D[]
                {
                    testSprite = new Sprite3D
                    {
                        Colour       = Color4.Blue, // Z
                        Texture      = testTexture,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(0.0f, 0.0f, 2.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Up, MathHelper.Pi)
                    },
                    testSprite1 = new Sprite3D
                    {
                        Colour       = Color4.Green, // Y
                        Texture      = testTexture,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(0.0f, 2.0f, 0.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Right, MathHelper.PiOver2)
                    },
                    new Sprite3D
                    {
                        Colour       = Color4.Red, // X
                        Texture      = testTexture,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(2.0f, 0.0f, 0.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Up, -MathHelper.PiOver2)
                    },
                    billboardRoot = new Sprite3D // Billboard
                    {
                        Colour       = Color4.Orange,
                        Rectangle    = new RectangleF(-0.25f, -0.25f, 0.5f, 0.5f),
                        Texture      = testTexture,
                        Billboard    = true,
                        BlendingMode = BlendingMode.Mixture,
                        Position     = new Vector3(0.0f, 0.0f, 0.0f),
                        Rotation     = Quaternion.FromAxisAngle(Vector3.Up, -MathHelper.PiOver2),
                        Children     = new Drawable3D[]
                        {
                            new Sprite3D                      // Child Billboard
                            {
                                Colour       = Color4.Orange, // X
                                Texture      = testTexture,
                                Billboard    = true,
                                BlendingMode = BlendingMode.Mixture,
                                Position     = new Vector3(0.0f, 1.0f, 0.0f),
                                Rotation     = Quaternion.FromAxisAngle(Vector3.Up, -MathHelper.PiOver2)
                            },
                        }
                    },
                    cameraBoom = new Node
                    {
                        Children = new Drawable3D[]
                        {
                            new Camera()
                            {
                                Position = new Vector3(0.0f, 0.0f, 5.0f)
                            }
                        }
                    }
                }
            });

            testSprite1.FadeColour(Color4.LimeGreen, 1000, EasingTypes.InCubic);
            testSprite1.Loop();

            animation = Scheduler.AddDelayed(() =>
            {
                testSprite.Rotation    *= Quaternion.FromAxisAngle(Vector3.Forward, MathHelper.Pi * 0.001f);
                billboardRoot.Rotation *= Quaternion.FromAxisAngle(Vector3.Right, MathHelper.Pi * 0.002f);
            }, 10.0, true);
        }
Example #26
0
 public A3DKillSelfOffScreen(Drawable3D parent)
     : base(parent, 0)
 {
 }
Example #27
0
        public bool AsyncFinalize()
        {
            if (!m_resources.FinalizeLoad())
            {
                return(false);
            }

            m_obj3dResources = new ObjectRenderable3DStaticResources();

            var highwayParams = new MaterialParams();

            highwayParams["LeftColor"]  = m_lVolColor;
            highwayParams["RightColor"] = m_rVolColor;
            highwayParams["Hidden"]     = 0.0f;

            laserMaterial.BlendMode      = BlendMode.Additive;
            laserEntryMaterial.BlendMode = BlendMode.Additive;

            var keyBeamMesh = Mesh.CreatePlane(Vector3.UnitX, Vector3.UnitZ, 1, LENGTH_BASE + LENGTH_ADD, Anchor.BottomCenter);

            m_resources.Manage(keyBeamMesh);

            m_highwayDrawable = new Drawable3D()
            {
                Texture  = highwayTexture,
                Material = highwayMaterial,
                Mesh     = Mesh.CreatePlane(Vector3.UnitX, Vector3.UnitZ, 1, LENGTH_BASE + LENGTH_ADD, Anchor.BottomCenter),
                Params   = highwayParams,
            };
            m_resources.Manage(m_highwayDrawable.Mesh);

            for (int i = 0; i < 6; i++)
            {
                m_keyBeamDrawables[i] = new Drawable3D()
                {
                    Texture  = keyBeamTexture,
                    Mesh     = keyBeamMesh,
                    Material = basicMaterial,
                };
            }

            MaterialParams CreateVolumeParams(int lane)
            {
                var volParams = new MaterialParams();

                volParams["LaserColor"]  = lane == 0 ? m_lVolColor : m_rVolColor;
                volParams["HiliteColor"] = new Vector3(1, 1, 0);
                return(volParams);
            }

            void CreateVolDrawables(int lane, ref Drawable3D entryDrawable, ref Drawable3D exitDrawable)
            {
                entryDrawable = new Drawable3D()
                {
                    Texture  = entryTexture,
                    Mesh     = Mesh.CreatePlane(Vector3.UnitX, Vector3.UnitZ, 2 / 6.0f, 1.0f, Anchor.TopCenter),
                    Material = laserEntryMaterial,
                    Params   = CreateVolumeParams(lane),
                };
                m_resources.Manage(entryDrawable.Mesh);

                exitDrawable = new Drawable3D()
                {
                    Texture  = exitTexture,
                    Mesh     = Mesh.CreatePlane(Vector3.UnitX, Vector3.UnitZ, 2 / 6.0f, 1.0f, Anchor.BottomCenter),
                    Material = laserMaterial,
                    Params   = CreateVolumeParams(lane),
                };
                m_resources.Manage(exitDrawable.Mesh);
            }

            CreateVolDrawables(0, ref m_lVolEntryDrawable, ref m_lVolExitDrawable);
            CreateVolDrawables(1, ref m_rVolEntryDrawable, ref m_rVolExitDrawable);

            return(true);
        }
Example #28
0
 public A3DTarget(Drawable3D parent, FlightStats fs, Drawable3D target, int lifetime = 0)
     : base(parent, lifetime)
 {
     drawTarget  = target;
     flightstats = fs;
 }
Example #29
0
 /// <summary>
 /// Constructs a new ray that is expressed in terms of the object's trasnfomrs.
 /// This method is usefull for ray casting.
 /// </summary>
 /// <param name="drawable">The object to use</param>
 /// <returns>A new ray inverted by the transform of the object.</returns>
 public Ray ToObjectSpace(Drawable3D drawable)
 {
     return(new Ray(Vector3d.Transform(this.Origin, drawable.Transform.Value.Inverted()), Vector3d.Transform(this.EndPoint, drawable.Transform.Value.Inverted())));
 }
Example #30
0
 public A3DWaitForTarget(Drawable3D parent, FlightStats fs, int lifetime = 0)
     : base(parent, lifetime)
 {
     flightstats = fs;
 }
Example #31
0
 /// <summary>
 /// Instantiates a new HitTestResult instance on the specified Drawable with the
 /// specified hit point.
 /// </summary>
 /// <param name="drawable">The hit Drawable.</param>
 /// <param name="hitPoint">The point of hit.</param>
 public HitTestResult(Drawable3D drawable, Vector2d hitPoint) : this(drawable, new Vector3d(hitPoint))
 {
 }
Example #32
0
 public A3DScrollWithTerrain(Drawable3D parent)
     : base(parent)
 {
 }