Exemple #1
0
        public Trail(MovingObject pObjectToFollow, Single pMaxWidth, ColorEx pColor)
        {
            LoopResultStates = new LoopResultStates();

            Chain = new BillboardChain(Methods.GenerateUniqueID.ToString(CultureInfo.InvariantCulture));
            Chain.Material.SetSceneBlending(SceneBlendType.Replace);
            Chain.Material.DepthCheck = false;
            Chain.Material.DepthWrite = false;
            Chain.NumberOfChains = 1;
            Chain.IsVisible = false;
            World.Instance.SceneManager.RootSceneNode.AttachObject(Chain);

            Relaunch(pObjectToFollow, pMaxWidth, pColor);
        }
Exemple #2
0
        public Trail(MovingObject pObjectToFollow, Single pMaxWidth, ColorEx pColor)
        {
            LoopResultStates = new LoopResultStates();

            Chain = new BillboardChain(Methods.GenerateUniqueID.ToString(CultureInfo.InvariantCulture));
            Chain.Material.SetSceneBlending(SceneBlendType.Replace);
            Chain.Material.DepthCheck = false;
            Chain.Material.DepthWrite = false;
            Chain.NumberOfChains      = 1;
            Chain.IsVisible           = false;
            World.Instance.SceneManager.RootSceneNode.AttachObject(Chain);

            Relaunch(pObjectToFollow, pMaxWidth, pColor);
        }
Exemple #3
0
        public void Loop()
        {
            LoopResultStates.Clear();

            for (var i = 0; i < elementList.Count; i++)
            {
                var element = elementList[i];

                if (i == elementList.Count - elementsToDestroy)                 // hide the tail elements.
                {
                    element.Width = 0;
                    element.Color = ColorEx.Black;
                }
                else                 // decay the visible elements.
                {
                    element.Width *= 0.65f;
                    element.Color *= 0.6f;
                }
            }

            if (trailState == TrailState.Stopping)             // allow decay.
            {
                elementsToDestroy--;

                elementPositions[elementList.Count - 1].Origin    = finalPosition;
                elementPositions[elementList.Count - 1].Direction = Vector3.Zero;

                if (elementsToDestroy == 0)                 // remove completely.
                {
                    LoopResultStates.Remove = true;
                }
                else
                {
                    RemoveTail();
                }
            }
            else             // continue to follow.
            {
                AddHead();
                RemoveTail();
            }
        }