Beispiel #1
0
        private void DrawLine(MagnetPoint source, MagnetPoint desti, string input, bool create, bool fix)
        {
            Point ptSrc = source.indexPoint;

            source.State.SetPointIndexUsed(ptSrc, create);
            Point ptDst = desti.indexPoint;

            desti.State.SetPointIndexUsed(ptDst, create);

            Utils.Drawing.LineParam dummy = new Utils.Drawing.LineParam();
            dummy.Source      = ptSrc;
            dummy.Destination = ptDst;
            Pen testPen;

            if (create)
            {
                if (input == "0")
                {
                    testPen = new Pen(Color.Black, 4);
                }
                else
                {
                    testPen = new Pen(Color.Blue, 4);
                }
            }
            else
            {
                testPen = new Pen(Color.White, 4);
            }

            testPen.EndCap  = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
            dummy.LineColor = testPen;
            Utils.Drawing.DrawLine(_drawingBoard, dummy, fix);
        }
Beispiel #2
0
        private readonly Vector3 _fogColorDrive; //when music louder


        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="cGame">Handle to the Game object being used. Pass in null for this
        /// parameter if not using a Game object.</param>
        public DefaultTexturedQuadParticleSystemTemplate(Game cGame, Vector3 fogColorNormal, Vector3 fogColorDrive,
                                                         Boolean mulitplyFogColorYWithAvarageFrequency, Boolean mulitplyFogColorZWithAvarageFrequency)
            : base(cGame)
        {
            this.mcEmitterPointMagnet    = null;
            this.mbMagnetsAffectPosition = true;

            this._fogColorNormal = fogColorNormal;
            this._fogColorDrive  = fogColorDrive;

            this._mulitplyFogColorYWithAvarageFrequency = mulitplyFogColorYWithAvarageFrequency;
            this._mulitplyFogColorZWithAvarageFrequency = mulitplyFogColorZWithAvarageFrequency;
        }
Beispiel #3
0
        private void AddTransitions(MagnetPoint prev, MagnetPoint next, string input)
        {
            Transition_Wrapper currTrans = _lstTransFunc.Find(x => x.TransitionFunction.PrevState == prev.State.Name && x.TransitionFunction.Input == input);

            if (!currTrans.IsNull)
            {
                throw new Exception("something not deleted");
            }
            _lstTransFunc.Add(new Transition_Wrapper(new TransFunc(prev.State.Name, input, next.State.Name), prev, next));

            TransFunc[] dummy = new TransFunc[_lstTransFunc.Count];
            for (int i = 0; i < _lstTransFunc.Count; i++)
            {
                dummy[i] = _lstTransFunc[i].TransitionFunction;
            }

            _dfa.Transitions = dummy;
            DFAIsEdited?.Invoke();
        }
Beispiel #4
0
        private void DrawArcToSelf(MagnetPoint source, bool create, bool iszro, bool fix)
        {
            Utils.Drawing.LineParam dummy = new Utils.Drawing.LineParam();
            Pen testPen;

            if (create)
            {
                if (iszro)
                {
                    testPen = new Pen(Color.Black, 4);
                }
                else
                {
                    testPen = new Pen(Color.Blue, 4);
                }
            }
            else
            {
                testPen = new Pen(Color.White, 4);
            }

            Point reference = source.State.CenterLocation;

            if (iszro)
            {
                Point left  = new Point(reference.X - 5, reference.Y - 20);
                Point right = new Point(reference.X + 5, reference.Y - 20);
                dummy.Source      = source.State.GetPointIndex(left);
                dummy.Destination = source.State.GetPointIndex(right);
            }
            else
            {
                Point left  = new Point(reference.X - 5, reference.Y + 20);
                Point right = new Point(reference.X + 5, reference.Y + 20);
                dummy.Source      = source.State.GetPointIndex(left);
                dummy.Destination = source.State.GetPointIndex(right);
            }
            testPen.EndCap  = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
            dummy.LineColor = testPen;
            Utils.Drawing.DrawArc(_drawingBoard, dummy, iszro, fix);
        }
        /// <summary>
        /// Load the Particle System Events and any other settings
        /// </summary>
        public void LoadEmitterMagnetParticleSystem()
        {
            // Set the Particle Initialization Function, as it can be changed on the fly
            // and we want to make sure we are using the right one to start with to start with.
            ParticleInitializationFunction = InitializeParticleRandomDirection;

            // Remove all Events first so that none are added twice if this function is called again
            ParticleEvents.RemoveAllEvents();
            ParticleSystemEvents.RemoveAllEvents();

            // Setup the Emitter
            Emitter.ParticlesPerSecond = 100;
            Emitter.PositionData.Position = new Vector3(0, 50, 0);

            // Clear all of the Magnets so they can be re-added
            MagnetList.Clear();

            // Setup the Maget attached to the Emitter and add it to the Magnet List
            mcEmitterPointMagnet = new MagnetPoint(Emitter.PositionData.Position,
                                                    DefaultParticleSystemMagnet.MagnetModes.Attract,
                                                    DefaultParticleSystemMagnet.DistanceFunctions.Cubed,
                                                    0, 100, 15, 0);
            MagnetList.AddFirst(mcEmitterPointMagnet);

            // Allow the Particle's Velocity, Rotational Velocity, Color, and Transparency to be updated each frame
            ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity);
            ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity);
            ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp);

            // This function must be executed after the Color Lerp function as the Color Lerp will overwrite the Color's
            // Transparency value, so we give this function an Execution Order of 100 to make sure it is executed last.
            ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100);

            // Add the Magnet Event to the Particle Events
            AddMagnetParticleEvent();

            // Add Particle System Events
            ParticleSystemEvents.AddEveryTimeEvent(UpdateEmitterMagnetToTheEmittersPosition);
        }
Beispiel #6
0
 public Transition_Wrapper(TransFunc x, MagnetPoint src, MagnetPoint dst)
 {
     TransitionFunction = x;
     SourceIndex        = src;
     DestinationIndex   = dst;
 }